forked from dwmt/konvenient
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.ts
37 lines (31 loc) · 982 Bytes
/
index.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import {Configuration, Configurable, configurator} from 'konvenient';
configurator.withSources([`${__dirname}/config.json`]);
@Configuration()
class GrandparentConfiguration {
// File key: grandparent.port
// Env name: GRANDPARENT_PORT
@Configurable({
doc: 'The port on which the server listens.',
format: 'port',
neverLoadFromEnv: true,
})
port = 8080;
}
@Configuration()
class ParentConfiguration extends GrandparentConfiguration {
// For the inherited port property, this class has
// File key: parent.port
// Env name: PARENT_PORT
}
@Configuration()
class ChildConfiguration extends ParentConfiguration {
// For the inherited port property, this class has
// File key: child.port
// Env name: CHILD_PORT
}
const grandParentConfig = new GrandparentConfiguration()
const parentConfig = new ParentConfiguration()
const childConfig = new ChildConfiguration()
console.log(grandParentConfig.port);
console.log(parentConfig.port);
console.log(childConfig.port);