Skip to content

Serverless plugin that implements configuration merge after variable expansion has occurred.

License

Notifications You must be signed in to change notification settings

CruGlobal/serverless-merge-config

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

Serverless plugin that implements configuration merge after variable expansion has occurred.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published