Skip to content
This repository has been archived by the owner on Feb 25, 2019. It is now read-only.

Keyfiles #2

Closed
tomkersten opened this issue May 30, 2014 · 6 comments
Closed

Keyfiles #2

tomkersten opened this issue May 30, 2014 · 6 comments

Comments

@tomkersten
Copy link
Contributor

Any thoughts on migrating the public/private keys for the server to be loaded only from environment variables (vs paths in the config file)?

@christiansmith
Copy link
Member

Loading from environment variables is a great suggestion for production environments. There may be cases where, for convenience, loading from a local file makes sense too (development)? What do you think about supporting both? Environment variables are obviously better for deployment. Is there a good reason to completely disallow loading from the filesystem? If both are supported, what would be the right priority for loading? First check the env, then for files? Use the first found or override one with the other?

@tomkersten
Copy link
Contributor Author

What if it was a JS file (vs JSON) which was required so the admin could use whichever method they preferred? For example:

var confg = {
  "issuer": "http://example.com",
  ...,
  "keypair": {
    "private": process.env.ANVIL_PRIVATE_KEY,
    "public": process.env.ANVIL_PUBLIC_KEY
  }
}

module.exports = config;

Thoughts?

@christiansmith
Copy link
Member

What do you think about using files for development and environment variables for production? Trying this in the latest release unstable release 0.1.5. See 79f66d6

@tomkersten
Copy link
Contributor Author

I think this would be fine. It's not something I feel strongly about, but I feel like you should be able to use an environment variable for either situation. However, 79f66d6 is a fine convention as well.

@christiansmith
Copy link
Member

@tomkersten With the current "deployment repository" setup, the keys directory is ignored for deployment. When the server bootstraps it will look first for environment variables, then for files. If both are present, the files will override the env. This gives us the ability to use files or the vars to test the production env on localhost, and guides implementers toward using vars in production instead of files. Sound reasonable?

@tomkersten
Copy link
Contributor Author

Seems reasonable.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants