slspress-config-loader

2.2.1 • Public • Published

slspress-config-loader

Loads environment config from a env config yaml file, a secret file and environment properties merging them together.

The idea is that the serverless.yml file can reference a file that calls this to load config that is then available in the serverless.yml file

For example:

serverless.yml:

custom:
  conf: ${file(./config/config-loader-${opt:stage}.js):config}
 
provider:
  region: ${self:custom.conf.region}
  vpc: ${self:custom.conf.vpc}
  environment: ${self:custom.conf.env}
  
...

config/config-loader-development.js:

module.exports.config = () => require('slspress-config-loader')(__dirname, 'development');

config/config.development.yml:

region: "us-east-1"
vpc:
  securityGroupIds:
    - ""
  subnetIds:
    - ""
    - ""
env:
  SOME_CONFIG: "config-value"

config/config.development.secret.yml: // added to .gitignore

env:
  SOME_SECRET_KEY: "shhh"

Dependencies (2)

Dev Dependencies (0)

    Package Sidebar

    Install

    npm i slspress-config-loader

    Weekly Downloads

    1

    Version

    2.2.1

    License

    MIT

    Last publish

    Collaborators

    • withreason_npm