Last active
January 7, 2018 23:18
-
-
Save pavelvlasov/8c30d3a27c6447b9d0da9db33ac7a447 to your computer and use it in GitHub Desktop.
Use cli parameters in serverless.js config
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
const program = require('commander'); | |
program | |
.option('--stage <n>', 'stage') | |
.option('--region <n>', 'region') | |
.option('--bucket <n>', 'bucket') | |
.parse(process.argv); | |
module.exports = { | |
service: 'sls-js-composition-config', | |
provider: { | |
name: 'aws', | |
runtime: 'nodejs6.10', | |
stage: program.stage || 'dev', | |
region: program.region || 'us-east-1', | |
memorySize: 128, | |
timeout: 10, | |
deploymentBucket: { | |
name: program.bucket || 'sls-js-config' | |
}, | |
environment: { | |
FOO: process.env.FOO, | |
BAR: process.env.BAR | |
} | |
}, | |
functions: { | |
hello: { | |
handler: 'index.hello', | |
events: [ | |
{ | |
http: { | |
path: 'hello', | |
method: 'get' | |
} | |
} | |
] | |
} | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment