Repository navigation
v2.1.0
What's Changed
The env prefix is the application's
NESTRS_ was a fixture; it is now a default. An app declares its own once and
every framework variable follows — ACME_ENV, ACME_LOG, ACME_HTTP__PORT,
ACME_DATABASE__URL:
nest_rs::env_prefix!("ACME");- A link-time declaration, not a setter. The prefix is read before anything
else —<PREFIX>_ENVselects the.envcascade,<PREFIX>_LOGconfigures
the subscriber beforemainhas built anything — so a setter would carry an
ordering rule nobody can verify.inventorymakes the declaration a fact
already true at the first read, wherever in the binary it is written.
Resolution caches into aOnceLock<&'static str>: no allocation added to any
path that was allocation-free. - It is a rename, not an alias. Once declared,
NESTRS_HTTP__PORTis inert.
A fallback would let a stale value silently win. - Every name is built from it, including the ones outside the
<PREFIX>_<DOMAIN>__<KEY>scheme:<PREFIX>_ENV, the three<PREFIX>_LOG*
variables, and the OpenTelemetry namespace.RUST_LOGkeeps its name — it is
the ecosystem's, not ours. - Error messages name the variable the operator actually has. Every
hardcodedNESTRS_AUTHN__SECRET-style literal in authn, redis, seaorm and the
test harness now goes throughnest_rs_config::var_name, the readerless
primitiveConfigService::var_namedelegates to. nestrs new <name> --env-prefix ACMEwrites the declaration, the.env
cascade under the new names, and a[workspace.metadata.nestrs] env-prefix
entry — which is hownestrs doctorandnestrs g authlearn the project's
names instead of assuming ours.doctorreports the prefix it resolved.
One declaration per generated binary: themigrationsandseedtools link
neither the feature crate nor each other, sonestrs run db upwould
otherwise resolveNESTRS_*against anACME_*cascade.- Compile-time shape check (uppercase ASCII, digits, underscores, no
trailing_), and two conflicting declarations in one binary abort at boot
naming both sites.
Existing apps are unaffected: declaring nothing keeps NESTRS.
Full Changelog: v2.0.0...v2.1.0