Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Expand MongoDB credentials #415

Merged
merged 1 commit into from
Mar 15, 2024

Conversation

achetronic
Copy link
Contributor

Hello there :)

When using external MongoDB, this docker image allow defining a mongodb connection string using the variable EAP_MONGOD_URI with the credentials inside as follows mongodb://root:whatever@your-ip-here/omada. This is working fine.

But in Kubernetes, the environment variables are usually loaded from a ConfigMap, and this type of manifests are commonly stored on git. However credentials are usually stored on a Secret resource, provisioned dynamically by a different flow.

As this image is not having different environment variables to define MongoDB user or password, we need a way to get them from another environment variables and put the content into the string. Some examples:

mongodb://root:$MONGODB_ROOT_PASSWORD@$MONGO_HOST/omada
mongodb://root:${MONGODB_ROOT_PASSWORD}@${MONGO_HOST}/omada

With the change I propose, this is covered as the content of the variable is expanded, so if the environment variable is defined into the connection string, it will be replaced with its content

@mbentley
Copy link
Owner

Nice, I like it - a simple solution too. Thanks for the PR. LGTM.

@mbentley mbentley merged commit be9a140 into mbentley:master Mar 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants