Skip to content

Instantly share code, notes, and snippets.

@Uvacoder
Forked from DavidWells/serverless-config.yml
Created January 2, 2022 01:51
Show Gist options
  • Select an option

  • Save Uvacoder/1404bb85023cff42d2a080cb099c33d6 to your computer and use it in GitHub Desktop.

Select an option

Save Uvacoder/1404bb85023cff42d2a080cb099c33d6 to your computer and use it in GitHub Desktop.
Serverless config with function support. https://github.com/DavidWells/configorama#usage
service: my-service
custom:
one: 'hello'
two: 'there'
together: ${merge(${custom.one}, ${custom.two})}
# ^ resolves to 'hellothere'
provider:
name: aws
runtime: nodejs8.10
functions:
currentTime:
handler: handler.endpoint
events:
- http:
path: ping
method: get
/* Serverless framework reads this file */
const path = require('path')
const configorama = require('configorama')
const cliFlags = require('minimist')(process.argv.slice(2))
// Path to yaml/json/toml config
const myConfigFilePath = path.join(__dirname, 'serverless-config.yml')
// Configorama can take file paths or JS objects.
const serverlessConfig = configorama.sync(myConfigFilePath, {
options: cliFlags
})
module.exports = serverlessConfig
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment