Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions examples/script-cjs-ts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,17 @@
"node": ">=18.0.0"
},
"scripts": {
"start": "DEBUG=config-dug* APP_ENV=development ts-node index.ts",
"start:staging": "DEBUG=config-dug* APP_ENV=staging ts-node index.ts",
"start:production": "DEBUG=config-dug* APP_ENV=production ts-node index.ts"
"start": "DEBUG=config-dug* APP_ENV=development tsx index.ts",
"start:staging": "DEBUG=config-dug* APP_ENV=staging tsx index.ts",
"start:production": "DEBUG=config-dug* APP_ENV=production tsx index.ts"
},
"dependencies": {
"config-dug": "^2.0.0-alpha.0"
},
"devDependencies": {
"@tsconfig/node18": "^1.0.3",
"@types/node": "^18.11.18",
"ts-node": "^10.9.1",
"tsx": "^4.19.1",
"typescript": "^4.9.4"
}
}
8 changes: 4 additions & 4 deletions examples/script-esm-ts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
"node": ">=18.0.0"
},
"scripts": {
"start": "DEBUG=config-dug* APP_ENV=development node --loader ts-node/esm --no-warnings index.ts",
"start:staging": "DEBUG=config-dug* APP_ENV=staging node --loader ts-node/esm --no-warnings index.ts",
"start:production": "DEBUG=config-dug* APP_ENV=production node --loader ts-node/esm --no-warnings index.ts"
"start": "DEBUG=config-dug* APP_ENV=development tsx index.ts",
"start:staging": "DEBUG=config-dug* APP_ENV=staging tsx index.ts",
"start:production": "DEBUG=config-dug* APP_ENV=production tsx index.ts"
},
"dependencies": {
"config-dug": "^2.0.0-alpha.0"
Expand All @@ -22,7 +22,7 @@
"@swc/helpers": "^0.5.0",
"@tsconfig/node18": "^1.0.3",
"@types/node": "^18.15.11",
"ts-node": "^10.9.1",
"tsx": "^4.19.1",
"typescript": "^4.9.5"
}
}
6 changes: 3 additions & 3 deletions examples/service-cjs-ts-tsyringe/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
"node": ">=18.0.0"
},
"scripts": {
"start": "APP_ENV=development ts-node src/index.ts",
"start:debug": "DEBUG=config-dug* APP_ENV=development ts-node src/index.ts"
"start": "APP_ENV=development tsx src/index.ts",
"start:debug": "DEBUG=config-dug* APP_ENV=development tsx src/index.ts"
},
"dependencies": {
"@config-dug/plugin-aws-secrets-manager": "^1.0.0-alpha.0",
Expand All @@ -20,7 +20,7 @@
"@tsconfig/node18": "^1.0.3",
"@types/node": "^18.15.11",
"reflect-metadata": "^0.2.1",
"ts-node": "^10.9.1",
"tsx": "^4.19.1",
"tsyringe": "^4.8.0",
"typescript": "^4.9.5"
}
Expand Down
1 change: 1 addition & 0 deletions examples/service-esm-ts/config.development.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
export default {
logLevel: 'debug',
API_TOKEN: 'development',
};
13 changes: 6 additions & 7 deletions examples/service-esm-ts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,18 @@
"node": ">=18.0.0"
},
"scripts": {
"start": "APP_ENV=development node --loader ts-node/esm --no-warnings src/index.ts",
"start:debug": "DEBUG=config-dug* APP_ENV=development node --loader ts-node/esm --no-warnings src/index.ts"
"start": "APP_ENV=development tsx src/index.ts",
"start:debug": "DEBUG=config-dug* APP_ENV=development tsx src/index.ts"
},
"dependencies": {
"@config-dug/plugin-aws-secrets-manager": "^1.0.0-alpha.0",
"config-dug": "^2.0.0-alpha.0"
"@config-dug/plugin-aws-param-store": "*",
"@config-dug/plugin-aws-secrets-manager": "*",
"config-dug": "*"
},
"devDependencies": {
"@swc/core": "^1.3.50",
"@swc/helpers": "^0.5.0",
"@tsconfig/node18": "^1.0.3",
"@types/node": "^18.15.11",
"ts-node": "^10.9.1",
"tsx": "^4.19.1",
"typescript": "^4.9.5"
}
}
33 changes: 27 additions & 6 deletions examples/service-esm-ts/src/config.ts
Original file line number Diff line number Diff line change
@@ -1,22 +1,43 @@
import { ConfigDug, z } from 'config-dug';
import { AWSSecretsManagerPlugin } from '@config-dug/plugin-aws-secrets-manager';
import { AWSParamStorePlugin } from '@config-dug/plugin-aws-param-store';
// import { AWSSecretsManagerPlugin } from '@config-dug/plugin-aws-secrets-manager';

const schema = {
logLevel: z.string().default('info'),
API_TOKEN: z.string(),
tracingEnabled: z.boolean().default(false),
apiToken: {
schema: z.string(),
sensitive: true,
alternateKeys: ['api-token', 'API_TOKEN'],
},
};

const awsSecretsManagerPlugin = new AWSSecretsManagerPlugin({
secrets: [
// const awsSecretsManagerPlugin = new AWSSecretsManagerPlugin({
// secrets: [
// {
// name: 'config-dug-test/config',
// region: 'ca-central-1',
// reloadInterval: '1m',
// },
// ],
// });

const awsParamStorePlugin = new AWSParamStorePlugin({
paths: [
{
name: 'config-dug-test/config',
path: '/config-dug-test/config',
region: 'ca-central-1',
reloadInterval: '1m',
},
],
sourceKeyStyle: 'kebab-case',
});

const configDug = new ConfigDug(schema, { plugins: [awsSecretsManagerPlugin] });
const configDug = new ConfigDug(schema, {
plugins: [awsParamStorePlugin],
printConfig: true,
outputKeyStyle: 'camelCase',
});

configDug.on('config-loaded', (config) => {
console.log('config-loaded event received', config);
Expand Down
4 changes: 0 additions & 4 deletions examples/service-esm-ts/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
{
"extends": "@tsconfig/node18",
"ts-node": {
"swc": true,
"esm": true
},
"include": ["./src/**/*"]
}
Loading
Loading