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

Add json.loads as new required_settings_type #82

Merged
merged 1 commit into from Feb 23, 2019

Conversation

drgarcia1986
Copy link
Owner

Useful to override complex settings from env, f.ex:

  • settings file
SIMPLE_CONF = {'simple': 'conf'}

SIMPLE_SETTINGS = {
    'OVERRIDE_BY_ENV': True,
    'REQUIRED_SETTINGS_TYPES': {
        'SIMPLE_CONF': 'json.loads',
    }
}
  • app
from simple_settings import settings

print(settings.SIMPLE_CONF)
  • execution
$ python app.py
{'simple': 'conf'}

$ SIMPLE_CONF='{"from": "env"}' python app.py
{'from': 'env'}

@coveralls
Copy link

Coverage Status

Coverage remained the same at 100.0% when pulling ed22378 on required_settings_type_json into 1278bd6 on master.

1 similar comment
@coveralls
Copy link

Coverage Status

Coverage remained the same at 100.0% when pulling ed22378 on required_settings_type_json into 1278bd6 on master.

@drgarcia1986 drgarcia1986 merged commit 7e3b4c5 into master Feb 23, 2019
@drgarcia1986 drgarcia1986 deleted the required_settings_type_json branch February 23, 2019 15:17
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