Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Number per env in automatic prune #21

Closed
r0mflip opened this issue May 1, 2020 · 3 comments
Closed

Number per env in automatic prune #21

r0mflip opened this issue May 1, 2020 · 3 comments

Comments

@r0mflip
Copy link

r0mflip commented May 1, 2020

Can we make the number key accept object so that we can specify values for multiple envs

custom:
  prune:
    automatic: true
    number:
      dev: 1
      prod: 3
      other: 3

Also supporting old behavior

custom:
  prune:
    automatic: true
    number: 3

IMHO This helps in a more declarative process in CI/CD

And also if this is acceptable I would like to work on it.

@claygregory
Copy link
Owner

Hi @r0mflip

Thanks for the idea! I can totally see your use-case. And I appreciate you checking in before beginning implementation. However, I don't think per-environment configuration within-plugin is the right path forward here, as serverless.yml already has pretty powerful variable resolution. I think this functionality is best served through that framework capability.


For example, if you prefer to keep per-environment pruning as config inside your project:

custom:
  prune:
    automatic: true
    number: ${file(./environments.yml):${self:provider.stage}.prune}

with environments.yml containing:

dev:
  prune: 1
stg:
  prune: 3
prd:
  prune: 4

You can also reference an environmental variable provided by your CI/CD pipeline, to override a default:

custom:
  prune:
    automatic: true
    number: ${env:PRUNE_NUMBER, 3}

Another common pattern would be to reference configuration from an SSM Parameter Store key.

Hope this helps!

@r0mflip
Copy link
Author

r0mflip commented May 2, 2020

Whoh, I totally forgot that this can be done by using the first method that you've mentioned. Thank you so much, that would help me with my use case. And would appreciate if the same is added to readme.

@claygregory
Copy link
Owner

Good point. I'll try to add in an FAQ and/or a "Tips" section to the readme to cover things like this sometime in the next week or so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants