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

WIP: OAS-19: Add base node cli #18

Merged
merged 6 commits into from
Aug 10, 2018
Merged

Conversation

facundovictor
Copy link
Contributor

This PR includes:

  • base cli structure with automated help and parameters recognition.
  • AWS credentials support + AWS env var support + option for specifying AWS profile + options for passing JSON config file.
  • npm-shrinkwrap to start locking dependencies (for if the CLI is published to npm in the future).

Next thing to add:

  • --init should create a bucket if does not exist and should upload the templates.
  • --apply should try creating the stack if it does not exist or update it using the templates stored in s3

We need to decide:

  • Are we going to include the CF templates inside the CLI package?
  • How much flexibility we should offer in terms of modifying the CF templates?
  • Need to decide the best way to pass the Stack parameters.

@facundovictor facundovictor self-assigned this Aug 7, 2018
bin/capsule.js Outdated
@@ -0,0 +1,62 @@
#!/usr/bin/env node
//#############################################################################
// @licence: ?
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MIT

bin/capsule.js Outdated
const loadAWSConfiguration = async (config_path, aws_profile) => {
// Environment variables should have higher precedence
// Reference: https://docs.aws.amazon.com/sdk-for-javascript/v2/developer-guide/loading-node-credentials-environment.html
if ((process.env.AWS_ACCESS_KEY_ID && process.env.AWS_SECRET_ACCESS_KEY) || process.env.AWS_PROFILE) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest moving all env declarations at the top so it's clearer which env vars are needed

const {
  // AWS Access Key
  AWS_ACCESS_KEY_ID,

  // AWS secret key
  AWS_SECRET_ACCESS_KEY,

  // AWS profile name
  AWS_PROFILE,
} = process.env;

@grgur
Copy link
Member

grgur commented Aug 7, 2018

Which version of node do you use? I like that you added npm shrinkwrap, but maybe it's easier for development (at this point) to use package-lock.json.

@facundovictor this is an excellent PR here!

grgur
grgur previously approved these changes Aug 7, 2018
@facundovictor
Copy link
Contributor Author

facundovictor commented Aug 7, 2018

Thanks @grgur , I'll apply the changes and add the node version into the package.json.
I'm using Docker for developing and installing the dependencies. If you agree I could add that portion and update the README file.

I used latest node v10.8.0, though, we should try setting up tests with mocha and different docker images with different node versions.

@grgur grgur merged commit 3322a99 into master Aug 10, 2018
@grgur grgur deleted the feature/OAS-19-add-base-node-cli branch August 10, 2018 12:06
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

Successfully merging this pull request may close these issues.

None yet

2 participants