serverless / serverless-secrets-plugin

MIT License
66 stars 16 forks source link

Adds the ability to specify a custom location for your credentials #4

Closed oliverturner closed 7 years ago

oliverturner commented 7 years ago

This PR provides a sample pattern for adding extra config for plugins under the custom config key:

custom:
  pluginConfig:
    secrets: 
      localPath: 'foo/bar'
    pluginName: 
      key1: val
      key2: val

It also consolidates the logic for calculating paths to secrets and encrypted files into a single function for the sake of consistency.

oliverturner commented 7 years ago

Unfortunately this approach doesn't work in the common case that one runs serverless decrypt -s {stage} -p pass on a supplied secrets.{stage}.yml.encrypted file. My guess is that this is because references in the plugin to serverless.yml cause it to get parsed and validated in advance of the secrets file being created: any properties dependent on this file will cause an error to be thrown.

Example:

Possible fixes

  1. Use an argument to the cli instead (annoying: wd be required on every operation)
  2. Pass a flag that prevents the validation
nikgraf commented 7 years ago

Do I understand correctly that this requirements was covered with https://github.com/serverless/serverless-secrets-plugin/pull/2

btw I released a new version of the plugin on NPM today

oliverturner commented 7 years ago

I think so... I'll let you know if not!

Thanks for the update 👍