feat: set JDBC credentials from environmental variables #1486
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.
Problem
At present, database credentials cannot be set via the environment from a container. This method of secret provisioning is widely used on containers running an application. For instance, when database passwords are not yet available when the ConfigMap on Kubernetes that holds the database credentials as
database.user
anddatabase.password
is generated, it is difficult to provide correct database credentials at runtime.Note: This can be tackled with the
valueFromEnv
mechanism on Kubernetes.Solution
This PR adds a small class that acts as
JdbcCredentialsProvider
that reads JDBC credentials from the CONNECT_JDBC_CONNECTION_USER and CONNECT_JDBC_CONNECTION_PASSWORD environmental variables.Note: The names were chosen somewhat consistent with official env var nomenclature for connect components described here.
Does this solution apply anywhere else?
If yes, where?
Test Strategy
Since this PR adds very little in terms of application logic, I did not add tests for now. When the feature added here is accepted, I would be more that happy to write some tests.
Testing done:
Release Plan