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

./config/secrets loading interface and order needs to match the ./config loading interface and order #19

Open
lxe opened this issue Apr 14, 2015 · 8 comments

Comments

@lxe
Copy link
Contributor

lxe commented Apr 14, 2015

I think we need to change the current interface of loading secrets in the context of environments.

We used to load config/secrets/secrets.json regardless of NODE_ENV, but after #17, secrets/secrets.json gets loaded iff NODE_ENV === 'production'

The interface to load the 'normal, non-secret config' is pretty nice:

  1. Load config/common.json
  2. If NODE_ENV is set to foo, load config/foo.json
  3. ...
  4. Profit

Adding secrets, now we have this:

  1. Load config/common.json
  2. If NODE_ENV is set to foo, load config/foo.json
  3. If NODE_ENV is set to foo, load config/secrets/secrets-foo.json...
    • Unless NODE_ENV is set to production, in that case config/secrets/secrets.json
  4. ...
  5. Cry

There's no reason to complicate the secrets interface. Why not do this???:

  1. Load config/common.json
  2. If NODE_ENV is set to foo, load config/foo.json
  3. Load config/secrets/common.json
  4. If NODE_ENV is set to foo, load config/secrets/foo.json
  5. ...
  6. Profit

cc @sh1mmer @Raynos @mlmorg

@sh1mmer
Copy link
Contributor

sh1mmer commented Apr 14, 2015

My understanding was that unlike other environment which can have inheritance we actively want to discourage developers from sharing secrets between environments. Hence that approach.

@lxe
Copy link
Contributor Author

lxe commented Apr 14, 2015

I think a consistent interface is worth more than guiding the user towards certain behavior.

@sh1mmer
Copy link
Contributor

sh1mmer commented Apr 15, 2015

I understand your position. I think consistency of interface is important but sharing or leaking secrets between environments is something we actively consider an anti-pattern. The interface for specify things per NODE_ENV environment still works e.g. secrets-development.json and secrets-test.json, etc if you need something in another environment. I'd be amiable to naming them to secrets/test.json or testing for both.

@rajeshsegu
Copy link

I am trying to move a web project on to zero-config. I have secrets same for both development and production. I wish there was something like "config/secrets/common.json" which might make it more cleaner and remove unnecessary redundancy.

cc @lxe @mlmorg @sh1mmer

@Raynos
Copy link
Contributor

Raynos commented Apr 21, 2015

The original common.json was a mistake. Even if we added one you would still need to ask Langley for this feature.

At this point we should favor having no more moves. The semantics are already complicated enough. Just let it be.

@Raynos
Copy link
Contributor

Raynos commented Apr 21, 2015

@rajeshsegu think very, very carefully about what you just said.

Your saying you want to deploy the same secrets, the same passwords to a development machine; a public machine on the Internet AND to a production machine; a private machine in the data center.

This means your putting our production secrets on the public internet. Congratulations.

@lxe
Copy link
Contributor Author

lxe commented Apr 21, 2015

@Raynos this is a configuration loader. There's nothing in the code that secures or ensures security of your secrets.

The way the secrets are offloaded and secured and then consumed by various machines has nothing to do at all with zero-config.

@rajeshsegu
Copy link

@Raynos Think about things like twitter { consumer_key, consumer_secret, .. }, s3 { accessKeyId, secretAccessKey }, googleMapsApiKey{} which is not going to be different for either development or production. Is the right design to generate multiple keys for development & production ? ( not sure how flexible it is )

If your argument is right, these details would live inside config/common.json or just be redundant in multiple secrets.

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

No branches or pull requests

4 participants