extract bootstrap secrets to env vars#1234
Open
nicolasgnr wants to merge 2 commits into
Open
Conversation
|
👋 nicolasgnr, thanks for creating this pull request! To help reviewers, please consider creating future PRs as drafts first. This allows you to self-review and make any final changes before notifying the team. Once you're ready, you can mark it as "Ready for review" to request feedback. Thanks! |
Contributor
There was a problem hiding this comment.
Pull request overview
Adds support in the bootstrapper configuration layer to resolve sensitive values (DB URL, keystore password) from environment variables with explicit precedence for values set directly in bootstrap.toml.
Changes:
- Introduced
KeystoreConfig.GetPassword()andDBConfig.GetURL()to centralize precedence/lookup logic (direct value > env var). - Refactored validation to use the new getters and updated bootstrap startup to consume resolved values.
- Added unit tests covering direct values, precedence, env var fallback, and error cases.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 8 comments.
| File | Description |
|---|---|
bootstrap/config.go |
Adds env-var-backed getters for keystore password and DB URL; updates validation to call getters. |
bootstrap/config_test.go |
Adds tests for the new getters and extends validation tests (though additional env-var validation cases are still needed). |
bootstrap/bootstrap.go |
Updates JD lifecycle startup to resolve DB URL and keystore password via the new getter methods. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
bukata-sa
previously approved these changes
Jul 3, 2026
|
Code coverage report:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
This PR adds support for resolving sensitive configuration values from environment variables instead of requiring them to be stored in the TOML configuration file
bootstrap.toml.Specifically, the database URL and keystore password can now be provided via environment variables, making it easier to manage secrets securely. If both a value and its corresponding environment variable are configured, the value defined in the configuration file takes precedence.
Changes
Added
GetURL()toDBConfigto resolve the database URL from either:URL(highest precedence)URLEnvVarAdded
GetPassword()toKeystoreConfigto resolve the keystore password from either:Password(highest precedence)PasswordEnvVarRefactored validation to use the new getter methods, centralizing configuration resolution and removing duplicated logic.
Updated the bootstrap flow to use the new resolution methods.
Added comprehensive tests covering:
Motivation
Secrets such as database credentials and keystore passwords should not be committed to or stored in plaintext configuration files. This change allows deployments to inject these values securely through environment variables while maintaining backward compatibility with existing configurations.
This allow as to move from
to
This change is fully backward compatible. Existing configurations that specify password and url directly continue to work unchanged.
In the future, once everything have migrated, we can remove the plaintext secret fields from the configuration, making environment variables the only supported mechanism for supplying sensitive values.