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

use django-env #1230

Merged
merged 1 commit into from
May 12, 2024
Merged

use django-env #1230

merged 1 commit into from
May 12, 2024

Conversation

fopina
Copy link
Contributor

@fopina fopina commented Apr 16, 2024

django-environ provides a clean interface to interact and cast settings from os.environ, allowing those to be replaced with a local .env file.

It also supports (my main reason to introduce it) X_FILE docker-like syntax, that will populate the enviornment variable X with the content of the file specified in X_FILE

Such as:

environment:
  PGPASSWORD_FILE: /run/secrets/pgpassword

@yogeshojha
Copy link
Owner

oh wow, I wasn't aware of this!

Thank you for submitting MR @fopina

I am reviewing this.

@yogeshojha
Copy link
Owner

@fopina is this going to affect any of the existing installations? For those who already have environment variables set, this change will be a breaking change?

@fopina
Copy link
Contributor Author

fopina commented Apr 18, 2024

Hi @yogeshojha , it should not be. All variables remain with same names, same defaults and mapped to the same settings.

The only small change is that it's loading variables from .env file by itself, instead of only relying on docker-compose to export them as actual environment variables, but that should have no impact - even if there is any difference between .env and actual environment variable, the actual env takes precedence in django-environ: default < env_from_file < env_for_real

@yogeshojha yogeshojha changed the base branch from master to release/2.1.0 May 12, 2024 13:32
@yogeshojha yogeshojha merged commit 0365285 into yogeshojha:release/2.1.0 May 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants