@cruglobal/serverless-merge-config

Serverless merge config adds the ability to merge configuration after serverless variables have been evaluated.

Stats

stars 🌟issues ⚠️updated πŸ› created 🐣size πŸ‹οΈβ€β™€οΈ
215Feb 5, 2021Mar 11, 2018Minified + gzip package size for @cruglobal/serverless-merge-config in KB

Readme

Serverless Merge Config

serverless Build Status Coverage Status npm version

Serverless merge config adds the ability to merge configuration after serverless variables have been evaluated.

Installation

Run:

# From npm (recommended)
npm install --save-dev @cruglobal/serverless-merge-config

# From github
npm install --save-dev https://github.com/CruGlobal/serverless-merge-config.git

Then make the following edits to your serverless.yml file:

plugins:
  - '@cruglobal/serverless-merge-config'
  - other-plugins

Including serverless-merge-config first will give other plugins access to the merged configuration.

How it Works

Serverless merge config works similarly to YAML merge except that it merges after serverless has completed variable substitution.

Use $<< property to merge:

provider:
    name: aws
    $<<: ${file:path/to/other.yml}

This will merge everything in path/to/other.yml to provider. Duplicate properties will be overridden by the merged value.

It is possible to use array if you want to merge variables from multiple sources:

provider:
    name: aws
    $<<:
      - ${file:path/to/other.yml}
      - ${file:path/to/another.yml}

This will merge everything in path/to/other.yml, then in file:path/to/another.yml to provider. Duplicate properties will be overridden by the merged value.

caveat: serverless print will not show the merged configuration. This command reloads and parses serverless.yml a second time with no hooks for plugins to tie into.

Contributing

We welcome pull requests!

  1. For any sizable change, first open a GitHub issue to discuss your idea.
  2. Create a pull request. Explain why you want to make the change and what it’s for.

If you find any bugs or have a feature request, please open an issue on github!

The npm package download data comes from npm's download counts api and package details come from npms.io.