Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What changed?
This PR modifies the config loading behavior to make environment variable-based configuration the default, and adds a new
--config-from-envflag for explicit control.Key Changes:
New Default Behavior:
temporal start(without flags) now loads configuration from the embedded template using environment variables, rather than attempting to load from./config/development.yamlFile-Based Loading: Config files are only loaded when
--config,--env, or--zoneflags are explicitly set. If these flags are set but files don't exist, the loader returns an error instead of falling back to the embedded templateNew Flag: Added
--config-from-envflag to explicitly signal environment-based configuration (equivalent to the new default behavior)Improved Error Handling: The config loader no longer silently falls back to embedded template when config files are missing - it returns a clear error message
Structured Logging: Bootstrap logging now uses zap with console encoding to match Temporal's standard log format, providing structured output during config loading
Why?
Primary Motivation
This change enables removing
dockerizeas a dependency in the Docker image. The previous template syntax was incompatible with the template parser, and the parser didn't accept environment variables as input. By making environment-based configuration the default, containerized deployments can configure Temporal entirely through environment variables without additional tooling.Breaking Change Note
Before:
temporal start→ Loads from./config/development.yaml(or falls back to embedded template if not found)After:
temporal start→ Loads from embedded template using environment variablestemporal --env=prod start→ Loads from./config/prod.yaml(fails if not found, no fallback)temporal start --config-from-env→ Explicitly loads from embedded template using environment variablesUsers who rely on the previous default behavior of loading
./config/development.yamlmust now explicitly use--env=developmentto maintain that behavior.How did you test it?
Testing Details:
Unit Tests:
TestInvalidPathto expect error when config files don't exist (no fallback)TestLoadWithEmbeddedTemplateto use explicituseEmbeddedOnlyflagManual CLI Testing:
Default behavior (no flags): Confirmed loads from embedded template with env vars
DB=postgres12 POSTGRES_SEEDS=localhost temporal start # Output: "Loading configuration from environment variables only"Explicit file loading: Confirmed attempts to load files and fails when missing
temporal --env=prod start # Output: "Unable to load configuration: failed to get config files: no config files found"Flag validation: Confirmed conflicting flag detection works
temporal --env=prod start --config-from-env # Output: "ERROR: --config-from-env cannot be used with --env flag"Explicit env flag: Confirmed
--config-from-envworks as expectedtemporal start --config-from-env # Output: "Loading configuration from environment variables only"Potential risks
Breaking Change Impact
The default behavior change may break existing deployments that rely on implicit config file loading. Specifically:
Local Development: Developers who run
temporal startexpecting it to load./config/development.yamlwill need to update their workflow to usetemporal --env=development startDeployment Scripts: Any automation that doesn't explicitly set
--env,--config, or--zoneflags will now use environment-based configuration instead of file-basedMigration Path: Users need to either:
--envflagMitigation
--config-from-envflag provides explicit documentation of the configuration sourceQuestions for Reviewers