This package mainly handle all the secrets and non-secrets management for the sub projects in Main Respond.io repository. This Supports for AWS ECS services and Lambda functions.
- Run the following command to install package into project.
npm i @respond-io/config-manager-pkg --save
- For ECS services you can use following code snippet to initialize the package.
// For local development, load environment variables from .env file
if (!(process.env.ECS_CONTAINER_METADATA_URI_V4 || process.env.ECS_CONTAINER_METADATA_URI)) {
const dotenv = require('dotenv');
dotenv.config({ path: '.env' });
} else {
const ECS = require('@respond-io/config-manager-pkg')('ecs');
const ecsConfig = new ECS();
await ecsConfig.loadSecrets();
}
- For Lambda functions you can use following code snippet to initialize the package.
//in /layer../app/index.js
const { lambdaWrapper } = require('@respond-io/config-manager-pkg')('lambda');
...
...
module.exports = {
SSMLambdaWrapper: lambdaWrapper
};
//in /functions/<function-name>/app.js
const { ...., SSMLambdaWrapper } = require('app');
...
const lambdaHandler = async (event) => {
// Lambda Logic
}
...
exports.lambdaHandler = SSMLambdaWrapper(lambdaHandler);