Skip to main content

Module env

Module env 

Source
Expand description

Process-wide service configuration loaded from dotenv files and the environment.

AppEnvironment is a singleton (backed by a OnceCell): provision it once with AppEnvironment::with_env_file, then read it with AppEnvironment::get or AppEnvironment::try_get. It carries service identity (SERVICE_NAME, SERVICE_VERSION, BUILD_NUMBER), connection URLs for Postgres/Redis/RabbitMQ/MongoDB, ports and replica counts, and the EnvironmentKind, ProcessRole, and SetupMode selectors.

AppEnvironment::with_env_file(None)?;
let env = AppEnvironment::get();
let pg_url = env.pg_url.clone();

Structs§

AppEnvironment
Loaded service configuration. Obtain via AppEnvironment::get after provisioning.

Enums§

DatabaseSslMode
PostgreSQL SSL mode selector.
EnvError
Errors returned when loading or querying AppEnvironment.
EnvironmentKind
Deployment environment selector, parsed from ENVIRONMENT_KIND (case-insensitive).
ProcessRole
Role of this process, parsed from PROCESS_ROLE (case-insensitive, defaults to "WORKER").
SetupMode
Setup selector, parsed from SETUP_MODE (case-insensitive, defaults to "PRODUCTION").