()
| 64 | } |
| 65 | |
| 66 | export async function main() { |
| 67 | const ctx = new Context(); |
| 68 | ctx.bind(ContextBindings.CONFIGURATION_RESOLVER).toClass(EnvConfigResolver); |
| 69 | |
| 70 | // Configure `foo` with `{bar: 'abc'}` |
| 71 | // To override it with env var, use `foo='{"bar":"abc"}'`. |
| 72 | ctx.configure('foo').to({bar: 'abc'}); |
| 73 | |
| 74 | const fooConfig = await ctx.getConfig('foo'); |
| 75 | console.log(fooConfig); |
| 76 | |
| 77 | ctx.configure('bar').to('xyz'); |
| 78 | const barConfig = ctx.getConfigSync('bar'); |
| 79 | console.log(barConfig); |
| 80 | } |
| 81 | |
| 82 | if (require.main === module) { |
| 83 | main().catch(err => { |
no test coverage detected