Skip to content

Now asking for value of missing environment variables#645

Merged
leo merged 13 commits into
masterfrom
env-fields
Jun 12, 2017
Merged

Now asking for value of missing environment variables#645
leo merged 13 commits into
masterfrom
env-fields

Conversation

@leo

@leo leo commented Jun 7, 2017

Copy link
Copy Markdown
Contributor

If your env config property contains an array instead of an object, now will ask you for the value of these environment variables. This makes the initial command much shorter (no -e needed)!

BEFORE

now -e SLACK_API_TOKEN="<token>" \
    -e SLACK_SUBDOMAIN="<team-name>" \
    -e GOOGLE_CAPTCHA_SECRET="<secret>" \
    -e GOOGLE_CAPTCHA_SITEKEY="<sitekey>" \
    now-examples/slackin

AFTER

now now-examples/slackin
"env": [
  "SLACK_API_TOKEN",
  "SLACK_SUBDOMAIN",
  "GOOGLE_CAPTCHA_SECRET",
  "GOOGLE_CAPTCHA_SITEKEY"
]

Leads to (similar):

screen shot 2017-06-07 at 16 13 54

This is how we do it.

@leo leo requested a review from rauchg June 7, 2017 14:12
Comment thread bin/now-deploy.js Outdated
}

console.log(
'> Please enter the values for the following environment variables:'

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Please use the info helper 🙏

Comment thread bin/now-deploy.js Outdated
nowConfig.env = await envFields(nowConfig.env)
}

console.log(nowConfig.env)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This shouldn't be here right 😅

Comment thread bin/now-deploy.js Outdated
// Merge `now.env` from package.json with `-e` arguments.
const pkgEnv = nowConfig && nowConfig.env

if (Array.isArray(nowConfig.env)) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This breaks deployments that don't have a now on package.json or a now.json:
image

@leo

leo commented Jun 9, 2017

Copy link
Copy Markdown
Contributor Author

Thank you, @matheuss. Applied your wishes! 😊

@matheuss matheuss left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@matheuss matheuss left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

👎
image

@leo

leo commented Jun 10, 2017

Copy link
Copy Markdown
Contributor Author

@matheuss Done!

@leo leo changed the title Ask for value of missing environment variables Now asking for value of missing environment variables Jun 12, 2017
@leo leo merged commit ac2a75f into master Jun 12, 2017
@leo leo deleted the env-fields branch June 12, 2017 14:24
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.

2 participants