discfg icon indicating copy to clipboard operation
discfg copied to clipboard

Set environment variables command

Open tmaiaroto opened this issue 8 years ago • 0 comments

I need to test this theory out, but I'm hoping there's a minimally invasive way to set environment variables for a command with discfg.

For example, one might run a command like this:

MY_DATABASE=connectionString ./runMyApp

I do it all the time to test apps locally with dev or staging databases. You don't want to store all the connection strings and other config info (especially if sensitive - for example AWS credentials) within the app code of course. So we use environment variables a lot.

Hence discfg...But what if the codebase only needed those variables at runtime? What if the config didn't need to update once the program was launched?

We could instead run a command like this:

discfg load myConfig ./runMyApp

The last argument would be passed through discfg to be executed...Or maybe (if possible):

discfg load myConfig && ./runMyApp

tmaiaroto avatar Apr 06 '16 18:04 tmaiaroto