Skip to content

Instantly share code, notes, and snippets.

@SteffenL
Last active February 8, 2020 07:42
Show Gist options
  • Save SteffenL/c4eafacd313a4325f45216425ac0672d to your computer and use it in GitHub Desktop.
Save SteffenL/c4eafacd313a4325f45216425ac0672d to your computer and use it in GitHub Desktop.
Update AppVeyor Server appsettings.json
import os, codecs, json
appsettings_path = "/etc/opt/appveyor/server/appsettings.json"
with codecs.open(appsettings_path, mode="rb", encoding="utf8") as f:
appsettings = json.JSONDecoder().decode(f.read())
# SQLite, SQL Server, PostgreSQL
db_provider = os.getenv("APPVEYOR_DATABASE_PROVIDER")
appsettings["AppVeyor"]["Database"]["Provider"] = db_provider
appsettings["AppVeyor"]["Database"][db_provider + "ConnectionString"] = os.getenv("APPVEYOR_DATABASE_CONNECTION_STRING")
appsettings["AppVeyor"]["Security"]["MasterKey"] = os.getenv("APPVEYOR_MASTER_KEY")
appsettings["AppVeyor"]["Security"]["MasterKeySalt"] = os.getenv("APPVEYOR_MASTER_KEY_SALT")
with codecs.open(appsettings_path, mode="wb", encoding="utf8") as f:
f.write(json.JSONEncoder().encode(appsettings))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment