Browse Source

Now deploy env fixes (#105)

* Fix key and value checks

- key can't be empty string nor undefined or null
- value is always undefined if it's not set

* Fix crash if env key and value are missing when using -e
master
Olli Vanhoja 8 years ago
committed by Guillermo Rauch
parent
commit
6d83be5f25
  1. 8
      bin/now-deploy.js

8
bin/now-deploy.js

@ -306,6 +306,10 @@ async function sync(token) {
}
const env_ = await Promise.all(envs.map(async kv => {
if (typeof kv !== 'string') {
error('Env key and value missing')
return process.exit(1)
}
const [key, ...rest] = kv.split('=')
let val
@ -318,12 +322,12 @@ async function sync(token) {
return process.exit(1)
}
if (key === '' || key === null) {
if (!key) {
error(`Invalid env option ${chalk.bold(`"${kv}"`)}`)
return process.exit(1)
}
if (val === null) {
if (val === undefined) {
if ((key in process.env)) {
console.log(`> Reading ${chalk.bold(`"${chalk.bold(key)}"`)} from your env (as no value was specified)`)
// escape value if it begins with @

Loading…
Cancel
Save