graflo.connections.env¶
Where connection settings come from outside a config file.
- The
conn_proxy→ environment-variable naming rule: every config resolved from the environment for aconn_proxylabel reads{PREFIX}<FIELD>, where PREFIX comes from :func:proxy_env_prefixunless the caller passes one explicitly. - The settings of the bundled docker services: :func:
docker_envreadsdocker/<service>/.env.example, the file the compose scripts pass with--env-file, so the containers and the configs agree.
Attributes¶
DOCKER_ENV_FILE = '.env.example'
module-attribute
¶
The settings file of each docker service, read by compose and by graflo.
DOCKER_ROOT = Path(__file__).resolve().parents[2] / 'docker'
module-attribute
¶
The repository's docker/ directory: one compose project per service.
Functions:¶
docker_env(service, docker_dir=None, *, required=True)
¶
The settings of a bundled docker service.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
service
|
str
|
The folder under |
required |
docker_dir
|
str | Path | None
|
Another folder holding the settings file, instead. |
None
|
required
|
bool
|
Raise when the file is missing; otherwise return |
True
|
Raises:
| Type | Description |
|---|---|
FileNotFoundError
|
The settings file is missing and required. |
Source code in graflo/connections/env.py
parse_env_file(path)
¶
KEY=value lines of path, quotes stripped, ${KEY} expanded.
A reference expands to a key set on an earlier line, as compose does; any
other reference is left as written. Blank lines and # comments are
skipped.
Source code in graflo/connections/env.py
proxy_env_prefix(conn_proxy)
¶
The environment-variable prefix of a conn_proxy label.
user_service → USER_SERVICE_; billing-api → BILLING_API_.