Open KamilLelonek opened 6 years ago
No, partly because a compile isn't meant to be used in one exclusive environment, and partly because binaries should never be built with environment values hard coded into the compiled result - that misses the entire point of environment variables.
Instead, adjust your code/config to actually look up your environment variables at runtime. This will solve both issues - the one you're asking about and the underlying one.
So how can I use secret key base or external DB URL in my config files?
On Fri, 12 Oct 2018 at 07:00, Dan Hunsaker notifications@github.com wrote:
No, partly because a compile isn't meant to be used in one exclusive environment, and partly because binaries should never be built with environment values hard coded into the compiled result - that misses the entire point of environment variables.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/nanobox-io/nanobox/issues/685#issuecomment-429204685, or mute the thread https://github.com/notifications/unsubscribe-auth/ADDRZdPaWCKUgIk4dbGuA-Yito4fl6gKks5ukCHbgaJpZM4XX9fn .
Same way. Especially for DB info/credentials, you want to pull those from the environment at runtime – even with only a single deploy environment, that information may change between compile and startup.
As to the exact approach you should use to ensure that happens correctly, that's highly language- and framework-dependent, so you're better asking about that in communities more familiar with those.
OK, that won't work in my case. Too bad, thanks.
I know Elixir supports it. I don't know how. Ask around.
Image: Elixir
Code that fails the build:
Error:
Is there a way to make env vars available at compile time?