Use exported environment vars during pack build #4950
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hey all, in using the builder-pack packer, I came across the scenario where my apps' config variables weren't being drawn into the build process like the documentation intimated it would/should.
Digging into it, I discovered that in the builder-pack build script, the
config_export
is called and stored in a file, but then that file is never touched again.Figuring this was an oversight, I made a fix and would like to share it back into the codebase.
Why did I use
sed
on the "pretty" format instead of just use the "envfile" format?Great question.
The tl:dr; is that the "envfile" format provided by
config
is actually incorrect: it surrounds the value of the variable in single quotes, ie.causing the value to include the quotes, because environment variables should* be specified as
After digging through the
config
subcommand codebase, I determined that this is being done by a dependency package (namelygithub.com/joho/godotenv
) - rather than start wrangling the format (which might have implications elsewhere) I opted for a more localised solution.*I couldn't find an authoritative source for the exact semantics of a dotenv file, but every other platform and system I have ever seen or used does not wrap the value in quotes. I'm happy to be wrong, but
pack
requires no-quote syntax regardless.Anyway. Love dokku, hope you find this PR helpful.