Package Exports
- @dsmrt/axiom-config
- @dsmrt/axiom-config/dist/index.js
- @dsmrt/axiom-config/dist/index.mjs
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@dsmrt/axiom-config) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Axiom - Config
An AWS focused config manager
This package focuses on the config part of axiom
Features
- Customize your application's config type interface
- load config based on environment
- Multiple environments/accounts/regions
- Secrets with SSM Parameters
Getting Started
Install Config
npm install @dsmrt/axiom-configConfig Usage
Example
- Add your config to the base of your project
Your project file structure
.
├── .axiom.dev.js
├── .axiom.js
├── README.md
├── package.json
├── src
│ └── config.ts
│ └── index.ts
└── tsconfig.jsonProd Config
// .axiom.js
const config = {
name: "my-prod-app",
env: "prod",
aws: {
account: "prod-account",
profile: "prod-profile",
region: "us-east-1",
// baseParameterPath can be used to secrets using ssm parameters (secure strings)
baseParameterPath: "/my-app/prod",
},
};
module.exports = config;Dev Config
// .axiom.dev.js
const config = {
name: "my-prod-app",
env: "dev",
aws: {
account: "dev-account",
profile: "dev-profile",
region: "us-north-1",
baseParameterPath: "/my-app/dev",
},
};
module.exports = config;Adding configs for your application based on your needs
// ./config.ts
// within your code
import { Config } from "@dsmrt/axiom-config"
export interface MyAppConfig extends Config {
appDomain: string;
appAcmCertArn: string;
}
Load the config within AWS CDK or your node application
import { MyAppConfig } from "./config"
import { loadConfig } from "@dsmrt/axiom-config"
const config = loadConfig<MyAppConfig>();
// or for dev
const config = loadConfig<MyAppConfig>({
env: "dev"
});
console.log(config.appDomain);