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

Allow to override default env variables with .env file #3338

Closed
wants to merge 2 commits into from

Conversation

leonidboykov
Copy link

@leonidboykov leonidboykov commented Jul 22, 2023

The godotenv.Load method does not overload the ENV variable if it is already present. This is a problem if you want to use --env-file to provide any settings with default values in Dockerfile. This means, that it's not possible to set DRONE_DATABASE_SECRET within .env file (trying to achieve the technique described here).

In the case of deploying the Drone, I'm sure that using godotenv.Overload is preferable, because this allows to keep the database password private with docker secrets.


My current workaround is using entrypoint to unset env variables:

entrypoint:
  - /bin/sh
  - -c
  - |
    set -e
    unset DRONE_DATABASE_DATASOURCE
    set -- /bin/drone-server "$$@"
    exec "$$@"
command:
  - /bin/drone-server
  - --env-file=/drone.secret.env

@CLAassistant
Copy link

CLAassistant commented Jul 22, 2023

CLA assistant check
All committers have signed the CLA.

@hitesharinga hitesharinga changed the base branch from master to drone October 4, 2023 02:46
@bot2-harness
Copy link
Collaborator

This PR has been automatically closed due to inactivity.

@leonidboykov
Copy link
Author

What kind of activity is expected by the bot?

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

3 participants