nanovms / ops

ops - build and run nanos unikernels
https://ops.city
MIT License
1.3k stars 132 forks source link

[:tada:] add env var interpolation to config files #1390

Closed zeroecco closed 2 years ago

zeroecco commented 2 years ago

This feature PR allows the JSON configuration file to interpolate environmental variables allowing templating for a multitude of reasons including but not limited to:

eyberg commented 2 years ago

I'm generally in favor of this and something we already wanting to add as I attached a tkt to it - I also did a quick search of all the pkgs i have locally and nothing turned up '$' surprisingly

i know software that would use this (commonly seen in java applications espc) would already do the interpolation when ran in the shell which we wouldn't support regardless

I'm just wondering if there are examples where $ or ${} might appear in a config or package.manifest and we wouldn't want it to turn into empty string

barring any concerns from @nanovms/engineering perhaps adding a little env bool to turn this behavior on would eliminate that concern?

eg if os.Getenv("interop") != "" {...} else {...}

zeroecco commented 2 years ago

I can add this flag

eyberg commented 2 years ago

I think if you add that flag then we could go ahead and merge this; not sure if it's needed but it would prevent any accidental changes