Skip to content
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

Dev Environment Setup: Setup tooling #3

Closed
3 tasks
cadorn opened this issue May 17, 2015 · 10 comments
Closed
3 tasks

Dev Environment Setup: Setup tooling #3

cadorn opened this issue May 17, 2015 · 10 comments
Assignees

Comments

@cadorn
Copy link
Contributor

cadorn commented May 17, 2015

$feature #1

@jrf0110

  • Refactor config.js to init based on a JSON config. Then assign issue to me.

@cadorn

@jrf0110
Copy link
Member

jrf0110 commented May 18, 2015

@cadorn that's going to take me a little while. Just to clarify, I'm going to be finding all usage in cater of 3rd-party apis that use credentials, correct?

@jrf0110
Copy link
Member

jrf0110 commented May 18, 2015

Example of what you're looking for:

Yelp

Code links:

@cadorn
Copy link
Contributor Author

cadorn commented May 18, 2015

I'm going to be finding all usage in cater of 3rd-party apis that use credentials, correct?

It appears that all credentials and coming through https://github.com/goodybag/cater-api-server/blob/e8b454214ba6a62537a2b4fef849401f17154ba1/config.js already.

So it would be sufficient to refactor config.js so I can feed it with something like the following JSON structure and config.js can map the new values to the existing properties:

            "credentials": {
                "aws.amazon.com": {
                    "email": "dev@...",
                    "iamUserName": "......",
                    "accessKeyId": "...",
                    "secretAccessKey": "...."
                },
                "dnsimple.com": {
                    "email": "...",
                    "token": "...."
                },
                "digitalocean.com": {
                    "email": "....",
                    "token": "....",
                    "tokenName": "..."
                }
            }

In addition to the credentials I need to be able to specify namespaces for stores such as S3 buckets.

There are two options for this:

  1. Prefix all tables/buckets/keys in config.js with ONE value I can set per system instance in config.js (sufficient initially)

  2. Arrive at another JSON structure to configure stores in detail. This will happen over time and look something like this:

            "stores": {
                "static-build-assets": {
                    "credentials": "aws.amazon.com",
                    "s3": {
                      "bucket": "profile.pio.pinf.io"
                    }
                }
            }

@cadorn
Copy link
Contributor Author

cadorn commented May 18, 2015

Example of what you're looking for: Yelp

Now that I found the config.js file I don't need the list like this. Its easy enough to issue a search on a config property and see where it is used in the codebase.

@jrf0110
Copy link
Member

jrf0110 commented May 18, 2015

Very good. That was going to be a pain :D

Refactoring that way seems reasonable. I can go ahead and start converting at least our s3 configs to that format

@cadorn
Copy link
Contributor Author

cadorn commented May 22, 2015

This is how I would like to setup the credentials in the new core system after our discussion today: https://github.com/goodybag/goodybag-core/tree/master/config

So for the catering server if you could structure the credential files the same way and use the default one plus each environment override. In the catering server you can keep committing the actual credential values but in the new core system I will eventually commit the values in an encrypted fashion so you don't leak any credentials to github or elsewhere. Once this is working you can use the new credential system in the catering server and remove the credential files from the project. Then rotate all API keys to lock things down. Filed issue for reminder: https://github.com/goodybag/goodybag-core/issues/1

@cadorn
Copy link
Contributor Author

cadorn commented May 22, 2015

So for the catering server if you could structure the credential files

You can run the JS file and export the credentials object as JSON to convert it to JSON automatically instead of reformatting manually.

@cadorn cadorn mentioned this issue May 25, 2015
6 tasks
@jrf0110
Copy link
Member

jrf0110 commented May 25, 2015

I went ahead and merged goodybag/cater-api-server#1730 - Preston had an item on there that I fixed, but everyone was gone by that point. Today is a holiday and we're under Tornado Warning at the moment. I may disappear.. into a shelter. haha

@cadorn
Copy link
Contributor Author

cadorn commented Jun 3, 2015

@jrf0110 I can start deploying the catering server to try and get it booted on a new VM as soon as credentials are loaded from files: #3 (comment)

To implement the credentials loading simply load the default and environment specific credentials files into objects and merge them using the deepmerge npm package: var credentials = require('deepmerge')(<credentials.json>, <credentials.env.json>)

@cadorn
Copy link
Contributor Author

cadorn commented Jul 28, 2015

$future Complete if and when moving catering server to tooling

@cadorn cadorn closed this as completed Jul 28, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants