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

Impossible to merge env files #509

Closed
AntonyCook opened this issue Mar 8, 2019 · 9 comments
Closed

Impossible to merge env files #509

AntonyCook opened this issue Mar 8, 2019 · 9 comments
Assignees
Labels

Comments

@AntonyCook
Copy link

Am I doing something wrong, or is it not (yet) possible to merge x-env files ?

@hairyhenderson
Copy link
Owner

Hi @AntonyCook - thanks for reporting this. How are you trying to merge env files?

@hairyhenderson
Copy link
Owner

I just tried this out, and indeed got an error 😱:

$ cat 1.env
FOO=1
BAR=2
BAZ=3
$ cat 2.env
FOO=4
QUX=5
$ gomplate -c "merged=merge:./2.env|./1.env" -i '{{ .merged.FOO }}'
Couldn't read datasource 'merged': unexpected data type 'map[string]string' for datasource (type application/x-env); merge: can only merge maps

🤔 this seems nonsensical - a map[string]string is a map... but I'll dig a little deeper to see what the problem is!

@hairyhenderson hairyhenderson changed the title possible to merge x-env Impossible to merge env files Mar 9, 2019
@hairyhenderson
Copy link
Owner

(I've taken the liberty to change the title to express that this is, in fact, a bug 😉)

@hairyhenderson
Copy link
Owner

I've tested this out with equivalent JSON files, and it works, so the bug is specific to how .env files are handled.

@AntonyCook
Copy link
Author

Yup, that's exactly what I was getting...glad I'm not going nuts !
Thanks for quick response..love the tool...I was looking for a flexible templating solution to use instead of Helm as we've got a bunch of microservices, home grown Jenkins jobs and different yml for each service per environment. Yml and JSON merging works fine so I might just convert our properties files to yml as a workaround.

Keep up the good work!

@hairyhenderson
Copy link
Owner

@AntonyCook thanks for the kind words! The bug's fixed, and I'll have it in a release soon!

@AntonyCook
Copy link
Author

Nice one..cheers Dave! I'll hold off my global search and replace :-)

@hairyhenderson
Copy link
Owner

@AntonyCook v3.3.1 is out now! 😬

@AntonyCook
Copy link
Author

excellent...tried it out and works a treat...thanks Dave.
Ant.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants