Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

defaults override custom-envoronment-variables #1

Copy link
Copy link
@peteroreil

Description

@peteroreil
Issue body actions

Hi,

It appears that the default.yml is overriding the custom-environment-variables.yml defined configuration.

Python Version: 2.7.8

Project Structure

  • ./requirements.txt
  • ./.python-version
  • ./config/custom-environment-variables.yml
  • ./config/default.yml
  • ./main.py
  • ./env

main.py

from config2.config import config

import os

print(os.environ['APP']) 
print('port', config.port) 

config/default.yml

port: 3000

config/custom-environment-variables.yml

port: APP

When run with python main.py config returns the default (3000) as expected
When run with APP=1111 python main.py config still returns 3000 where I expected 1111 however the APP environment variable is returning 1111.

Is virtualenv causing a problem here?

requirements.txt

attributedict==0.1.8
blessings==1.7
Click==7.0
colour-runner==0.1.1
config2==0.1.4
deepdiff==3.3.0
deepmerge==0.0.4
easypackage==0.1.8
filelock==3.0.9
itsdangerous==0.24
Jinja2==2.10
jsonpickle==1.0
MarkupSafe==1.0
pluggy==0.7.1
py==1.6.0
Pygments==2.2.0
PyYAML==3.13
six==1.11.0
toml==0.10.0
tox==3.5.2
virtualenv==16.0.0
Werkzeug==0.14.1

Thanks for your work btw

EDIT:
Just to add to this, defining configuration in another file works fine.
i.e config/foo.yml
and executing ENV=foo python main.py will return the correct configuration.

Reactions are currently unavailable

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    Morty Proxy This is a proxified and sanitized view of the page, visit original site.