MCPcopy Index your code
hub / github.com/loopbackio/loopback-next / main

Function main

examples/context/src/custom-configuration-resolver.ts:66–80  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

64}
65
66export 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
82if (require.main === module) {
83 main().catch(err => {

Calls 7

bindMethod · 0.95
configureMethod · 0.95
getConfigMethod · 0.95
getConfigSyncMethod · 0.95
toClassMethod · 0.80
toMethod · 0.80
logMethod · 0.65

Tested by

no test coverage detected