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

feat(parameters): ability to set maxAge and decrypt via environment variables #1384

Merged

Conversation

dreamorosi
Copy link
Contributor

@dreamorosi dreamorosi commented Mar 28, 2023

Description of your changes

This PR introduces two new environment variables to configure the behavior of the Parameters utility around caching (maxAge) and decryption (for SSM only).

Problem statement

Today the utility allows customers to configure caching and decryption via arguments passed to the utility functions or class methods. This allows to configure the retrieval and lifecycle of parameter values in a granular way.

Some customers however want to have shared settings that apply to all parameter values. For this reason we are adding two environment variables: POWERTOOLS_PARAMETERS_MAX_AGE and POWERTOOLS_PARAMETERS_SSM_DECRYPT that once set will apply to all parameter retrievals.

Additional info on the changes

Prior to this PR the Parameters utility was using environment variables only in one instance and only in the AppConfigProvider. With the introduction of these new environment variables this PR adds the EnvironmentVariablesService from the commons package to this library. With this service the Parameters utility has now access to shared utilities that allow to read and standardize the env vars retrieval.

Once merged this PR will close #1380.

Related issues, RFCs

Issue number: #1380

Checklist

  • My changes meet the tenets criteria
  • I have performed a self-review of my own code
  • I have commented my code where necessary, particularly in areas that should be flagged with a TODO, or hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have made corresponding changes to the examples
  • My changes generate no new warnings
  • The code coverage hasn't decreased
  • I have added tests that prove my change is effective and works
  • New and existing unit tests pass locally and in Github Actions
  • Any dependent changes have been merged and published
  • The PR title follows the conventional commit semantics

Breaking change checklist

Is it a breaking change?: NO

  • I have documented the migration process
  • I have added, implemented necessary warnings (if it can live side by side)

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Disclaimer: We value your time and bandwidth. As such, any pull requests created on non-triaged issues might not be successful.

@dreamorosi dreamorosi self-assigned this Mar 28, 2023
@pull-request-size pull-request-size bot added the size/L PRs between 100-499 LOC label Mar 28, 2023
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Housekeeping

@github-actions github-actions bot added the feature PRs that introduce new features or minor changes label Mar 28, 2023
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prior to this PR this method was used only in Logger. Now it's used also by Parameters so I am extracting it to the commons package to avoid duplication.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There was a lot of duplication with the GetOptions class here, so opted for inheritance.

@dreamorosi dreamorosi added the parameters This item relates to the Parameters Utility label Mar 28, 2023
@dreamorosi dreamorosi marked this pull request as ready for review March 28, 2023 17:51
@dreamorosi dreamorosi requested a review from am29d March 28, 2023 17:52
@dreamorosi
Copy link
Contributor Author

cc @heitorlessa - would like your input on env variables naming. Ideally I'd want to use the same names across runtimes so let's agree now if possible.

If not, we still have time to change the names on our side before GA.

Copy link
Contributor

@am29d am29d left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good.

@heitorlessa
Copy link
Contributor

heitorlessa commented Mar 29, 2023 via email

@dreamorosi dreamorosi merged commit dcf6620 into main Mar 29, 2023
@dreamorosi dreamorosi deleted the 1380-set-maxage-and-decrypt-via-environment-variables branch March 29, 2023 20:01
@mikebroberts
Copy link

Great! Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature PRs that introduce new features or minor changes parameters This item relates to the Parameters Utility size/L PRs between 100-499 LOC
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feature request: ability to set maxAge and decrypt via environment variables for Parameters
4 participants