apicrud.service_config¶
service_config.py
- Service Config
Flask and application configuration global defaults are defined in service_config.yaml. Overrides of defaults are evaluated in this order:
Values passed as a keyword arg at first class invocation
Values defined in a file in yaml format
Environment variables set by parent process
For security, the config singleton is stored as an immutable namedtuple: to change values, update settings and restart the container running the service.
An endpoint /config/v1/config provides read-only access to these values except those of type password. Always override those secret values before deploying your service.
Attribute keys specified as env vars are UPPERCASE, and attribute keys stored in the config object are also uppercase. Use lowercase to specify attribute keys in kwargs or the yaml input file.
created 12-aug-2020 by docker@instantlinux.net
Classes
|
Service config for flask application |
-
class
apicrud.service_config.
ServiceConfig
(file=None, models=None, reset=False, **kwargs)¶ Service config for flask application
- Parameters
file (str) – path of a YAML file defining override values
models (obj) – sqlalchemy db models
reset (boolean) – reset cached values (for unit tests)
**kwargs – key=value pair arguments to override values
- Raises
AttributeError if invalid specification –
-
set
(key, value)¶ Set a single value
- Parameters
key (str) –
- new value (value) –