-
Notifications
You must be signed in to change notification settings - Fork 1
Config #2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I think at the very least, a modules {
"name" : "Myapp",
"configs": {
"LEVEL_DB_URL": "a level-db server"
}
} The key in the above config stanza represents the name of the environment variable to pass in. The value of each entry is a description of what the variable should be. Given a |
I would definitely go with option 2. I don't want to specify a config file location every time I start a service. It could be a useful override sometimes, but I think option 2 works better. Being explicit about environment variable requirements is an interesting idea. You may want to consider a mechanism for specifying optional environment variables as well, but that may be too messy. I think it's fine to expand on package.json for some things, but I don't want to do it too often or too complexly. |
I think $ npkg start myapp The above will load |
Okay @EndangeredMassa let's talk config. I brought it up in #1 but want to give it a proper treatment here.
Modules that exposes services via a start script may need to start differently on different hosts. The clearest example is a webapp that requires a database connection. You cannot assume the database will exist at
127.0.0.1
, it may be on another host or have a non-standard port. Heroku handles this by passing in configuration as environment variables.I think the environment-variable style is good and familiar to people, so I'm going to keep using it. Init can easily handle this approach, you pass init a json stanza describing environment variables to pass to the child process. Easy! This also keeps init free from making assumptions about how packages should be run. In fact, init knows nothing about node modules at all. It's the
npkg
command that interprets thepackage.json
file in a module, and turns that into a daemon.I am fairly convinced that
npkg
is the right place to decide what environment variables to pass to init. I see two options here:a command line option
a standardized location for config files (e.g.
$HOME/etc/npkg/myapp.json
) when runningnpkg start myapp
.There is a third option, which I do not think is the right way to go, which is to do some complicated logic to determine what environment variables to pass in. I'd rather not bake that logic into
npkg
, it should just blindly pass in environment variables.defining environment variable config files
There are some environment variables I would like to standardize on passing into services, such as
TMPDIR
andVARDIR
. Also, if a module requires an environment variable such asMYSQL_URL
, we should start documenting those inpackage.json
.I would love for another tool to generate the default config, and to keep
npkg
free from dealing with config logic, but I'm also trying to make sure services are suuuuuper simple to install and run. I'm still debating what to do in my head, and am still undecided on option (1) or option (2).The text was updated successfully, but these errors were encountered: