@parkhub/config
v1.1.3
Published
serverless components configuration
Downloads
19
Maintainers
Keywords
Readme
config
Utilities for making use of serverless-components
Features
- Parse flags and set defaults
- Parse yml files and set to variable name
- Compose environment variables
Configuring
Config is meant to create variables accessible from the rest of the yml file. All parsed variables are available on the config output object.
# serverless.yml
config:
component: "@parkhub/config"
inputs:
flags:
stage: dev # the flag "stage" defaults to "dev"
files:
models: "./models.yml" # parse the specific file for a json object
environment:
# searched variable must be in the inputs object to be found
HOST: (custom.(flags.stage)-host) # define variables that depend on other variables
PATH: /api/v1
# custom is not parsed and can be named anything, it is here to be referenced from in environment
custom:
dev-host: https://yoda.homies
stage: ${config.stage} # dev or whatever is passed to --stage from cli
models: ${config.models} # contents of other yml file
host: ${config.HOST} # https://yoda.homies if stage === dev
Deploy
$ serverless