Skip to content

Conversation

@mattrobenolt
Copy link
Owner

Fixes GH-38

@mattrobenolt mattrobenolt mentioned this pull request Mar 23, 2017
@razvanphp
Copy link

Please add this to the README.md, really helps new users, maybe also specifying environ() trick too.

Thank you!

jinja2cli/cli.py Outdated
"""
dict_ = {}
for line in data.splitlines():
line = line.strip()
Copy link

@razvanphp razvanphp Mar 23, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think strip() has to be called after split(=), so both key & value have the spaces removed. eg. supporting foo = blah blah blah.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's not how envfile format works. If you used that value, you'd be getting a key of "foo " and a value of " blah blah blah", and would be intended behavior for environment variables. See my reference material in the issue.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also changed this to lstrip since it should only be stripping preceding spaces, not trailing spaces.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also based on what you originally said "dotenv", there are implementation of that that wouldn't cover what you're saying either:
https://www.npmjs.com/package/dotenv#rules for example which is much closer to what I wrote here. I'm matching Docker's behavior.

@mattrobenolt mattrobenolt merged commit 07a919e into master Jul 11, 2017
@mattrobenolt mattrobenolt deleted the envfile branch July 11, 2017 02:33
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.

3 participants