UNPKG

@aws-lambda-powertools/parameters

Version:
25 lines (24 loc) 687 B
import { getNumberFromEnv } from '@aws-lambda-powertools/commons/utils/env'; import { DEFAULT_MAX_AGE_SECS } from '../constants.js'; /** * Options for the `get` method. * * It merges the default options with the provided options. */ class GetOptions { forceFetch = false; maxAge; sdkOptions; transform; constructor(options = {}) { Object.assign(this, options); /* v8 ignore else -- @preserve */ if (options.maxAge === undefined) { this.maxAge = getNumberFromEnv({ key: 'POWERTOOLS_PARAMETERS_MAX_AGE', defaultValue: DEFAULT_MAX_AGE_SECS, }); } } } export { GetOptions };