air icon indicating copy to clipboard operation
air copied to clipboard

Allow specifying list of environment variables.

Open swhite24 opened this issue 4 years ago • 1 comments

Thanks for the great project. I've recently come across a case where I have many environment variables I'd like to provide to the binary and listing them all inline with the full_bin key was becoming a bit unwieldy.

This PR adds a new key, env, which will accept a table of inputs to prepend to the bin command as environment variables.

For example, this config (truncated):

# air.conf
[build]
bin = "tmp/main"
env.PORT = "3000"
env.ENV = "production"

Will run the following:

PORT=3000 ENV=production tmp/main

swhite24 avatar Feb 05 '20 17:02 swhite24

Wouldn't it be better to ask the user to have the list of env files as export commands in a separate file called dev.env and source the file before building, with bash it'd be source dev.env

udaya2899 avatar Jul 01 '20 20:07 udaya2899