Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

support configuration & env vars #39

Open
woloski opened this Issue · 8 comments

3 participants

@woloski

I would like to have a config.yml scaffolded when creating an app (it should also be added to .gitignore so it does't get added to the repo so we don't disclose keys when using public repos).

The scaffolded .yml file might look like:

# add your own config items that will be accesible using process.env._configkey_

node_env: production

Then we might have a

git azure app --config myapp

That would apply the current config.yml and spawn the env vars for that app on the server.

@tjanczuk
Owner

I wonder if this problem isn't already addressed with existing concepts:

  • for security insensitive configuration settings, store them in package.json,
  • for security sensitive configuration settings, use git azure blob to store them in Blob Storage, and if you need to reference a particular blob (e.g. a password or connection string), put the blob name in the package.json file.

This is exactly the approach I am taking with X.509 certificates and associated private keys.

@woloski

Blob storage sounds good, I forgot you already had a storage account available to use. What do you think of something like:

  • creating a blob (appname.yml) when scaffolding an app (git azure blob --put appname.yml --content "node_env: production" )
  • write a very simple config module (maybe a fork of this https://github.com/rjyo/yaml-config-node using blobs instead of fs) and include it as part of the scaffolded app
  • have a way to restart apps (git azure app --restart hello) so that configuration is reloaded
  • setup the env var AUZRE_STORAGE_ACCOUNT and KEY so that it works locally for dev

Regarding env vars, what I like about using them is that it is the universal config system in every cloud platform.

@johnnyhalife

Env Vars are the default nodejs configuration strategy, although I'd love to have a runtime ability like

jitsu set env VARIABLE value

or

heroku config:add VARIABLE=value

I'm working on a new approach. On start_worker if exists I'll call SetEnvVars.cmd which will live on the root of the repo (as package.json) hence it can be changed without repackaging (which has been trouble for me).

I'm working on this right now on my branch, and I'll submit a pull-request afterwards.

Thoughts?

@johnnyhalife

Just to keep the same patterns, file will be called set_env_vars.cmd :smile:

@tjanczuk
Owner

The set_env_vars.cmd will set the same set of environment variables for all applications, and changing them will require bringing down arr.js (which can be done with git azure reset --hard and takes ~2 minutes). If the variables are not security sensitive, perhaps a better approach would be have a section for them in the package.json of individual apps. arr.js can read that section and create appropriate environment block before starting a node.exe to handle a particular application. Moreover, this mechanism composes very well with the existing post-receive hook based mechanism of updating applications: you push changes to environment variables into package.json, and arr.js picks it up just like any other change in the application configuration or code.

@johnnyhalife
@tjanczuk
Owner
@johnnyhalife

Will do then, I like that better. I'm using the CMD and works fair enough, using the package.json will be even better =)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.