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::getafter provisioning.
Enums§
- Database
SslMode - PostgreSQL SSL mode selector.
- EnvError
- Errors returned when loading or querying
AppEnvironment. - Environment
Kind - Deployment environment selector, parsed from
ENVIRONMENT_KIND(case-insensitive). - Process
Role - Role of this process, parsed from
PROCESS_ROLE(case-insensitive, defaults to"WORKER"). - Setup
Mode - Setup selector, parsed from
SETUP_MODE(case-insensitive, defaults to"PRODUCTION").