48 lines
1.1 KiB
Python
48 lines
1.1 KiB
Python
"""Configuration from 1Password or other source."""
|
|
|
|
|
|
def get_app_config_dict(vault_id):
|
|
"""Gets the 1Password-style configuration dictionary for loading values.
|
|
|
|
Args:
|
|
vault_id (str): The ID of the vault to retrieve values from
|
|
|
|
Returns:
|
|
dict: Config dictionary
|
|
"""
|
|
app_config = {
|
|
"secret_key": {
|
|
"opitem": "DJANGO_SECRET_KEY",
|
|
"opfield": ".password",
|
|
},
|
|
"email_api_key": {
|
|
"opitem": "EXAMPLE_SENDGRID_API",
|
|
"opfield": ".credential",
|
|
},
|
|
"server": {
|
|
"opitem": "EXAMPLE_DB",
|
|
"opfield": ".server",
|
|
},
|
|
"database": {
|
|
"opitem": "EXAMPLE_DB",
|
|
"opfield": ".database",
|
|
},
|
|
"username": {
|
|
"opitem": "EXAMPLE_DB",
|
|
"opfield": ".username",
|
|
},
|
|
"password": {
|
|
"opitem": "EXAMPLE_DB",
|
|
"opfield": ".password",
|
|
},
|
|
"port": {
|
|
"opitem": "EXAMPLE_DB",
|
|
"opfield": ".port",
|
|
},
|
|
}
|
|
|
|
for key in app_config:
|
|
app_config[key]["opvault"] = vault_id
|
|
|
|
return app_config
|