@awsless/ssm
v0.0.7
Published
[![npm version](https://img.shields.io/npm/dw/@awsless/ssm)](https://www.npmjs.org/package/@awsless/ssm) [![npm version](https://img.shields.io/npm/v/@awsless/ssm.svg?style=flat-square)](https://www.npmjs.org/package/@awsless/ssm) [![license](https://img.
Downloads
73
Readme
Helper functions to fetch parameters from AWS SSM Parameter Store & easily mock the SSM client.
Basic usage
Example
import { ssm } from "@awsless/ssm";
const config = await ssm({
secret: '/your-ssm-secret-path'
})
console.log(config.secret)
Typed values:
import { string, float, integer, array, json } from "@awsless/ssm";
import { ssm, integer, json } from "@awsless/ssm";
type JsonStruct = {
username: string
password: string
}
const config = await ssm({
val1: integer('/path-to-int-value'),
val2: json<JsonStruct>('/path-to-json-value')
})
Expiring cache values
import { ssm } from "@awsless/ssm";
const config = await ssm({
secret: '/your-ssm-secret-path'
}, { ttl: 60 })
Mock the SSM Client
import { ssm, mockSSM } from '@awsless/ssm'
const mock = mockSSM({
'/path': 'Hi',
})
it('should resolve ssm paths', async () => {
const result = await ssm({
value: '/path',
})
expect(result).toStrictEqual({
value: 'Hi',
})
})