@travetto/config 8.0.0-alpha.20 → 8.0.0-alpha.22

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -13,7 +13,7 @@ npm install @travetto/config
13
13
  yarn add @travetto/config
14
14
  ```
15
15
 
16
- The config module provides support for loading application config on startup. Configuration values support the common [YAML](https://en.wikipedia.org/wiki/YAML) constructs as defined in [yaml](https://github.com/eemeli/yaml). Additionally, the configuration is built upon the [Schema](https://github.com/travetto/travetto/tree/main/module/schema#readme "Data type registry for runtime validation, reflection and binding.") module, to enforce type correctness, and allow for validation of configuration as an entrypoint into the application. Given that all [@Config](https://github.com/travetto/travetto/tree/main/module/config/src/decorator.ts#L13) classes are [@Schema](https://github.com/travetto/travetto/tree/main/module/schema/src/decorator/schema.ts#L19)-based classes, all the standard [@Schema](https://github.com/travetto/travetto/tree/main/module/schema/src/decorator/schema.ts#L19) and [@Field](https://github.com/travetto/travetto/tree/main/module/schema/src/decorator/field.ts#L24) functionality applies.
16
+ The config module provides support for loading application config on startup. Configuration values support the common [YAML](https://en.wikipedia.org/wiki/YAML) constructs as defined in [yaml](https://github.com/eemeli/yaml). Additionally, the configuration is built upon the [Schema](https://github.com/travetto/travetto/tree/main/module/schema#readme "Data type registry for runtime validation, reflection and binding.") module, to enforce type correctness, and allow for validation of configuration as an entrypoint into the application. Given that all [@Config](https://github.com/travetto/travetto/tree/main/module/config/src/decorator.ts#L13) classes are [@Schema](https://github.com/travetto/travetto/tree/main/module/schema/src/decorator/schema.ts#L19)-based classes, all the standard [@Schema](https://github.com/travetto/travetto/tree/main/module/schema/src/decorator/schema.ts#L19) and [@Field](https://github.com/travetto/travetto/tree/main/module/schema/src/decorator/field.ts#L26) functionality applies.
17
17
 
18
18
  ## Resolution
19
19
  The configuration information is comprised of:
@@ -30,7 +30,7 @@ Config loading follows a defined resolution path, below is the order in increasi
30
30
  By default all configuration data is inert, and will only be applied when constructing an instance of a configuration class.
31
31
 
32
32
  ### Mono Repo Support
33
- When working in a monorepo, the parent resources folder will also be searched with a lower priority than the the module's specific resources. This allows for shared-global configuration that can be overridden at the module level. The general priority is:
33
+ When working in a monorepo, the parent resources folder will also be searched with a lower priority than the the module's specific resources. This allows for shared-global configuration that can be overridden at the module level. The general priority is:
34
34
  1. Mono-repo root
35
35
  1. Module root
36
36
  1. Folders for `TRV_RESOURCES`, in order
@@ -104,12 +104,12 @@ Config {
104
104
  ```
105
105
 
106
106
  ### Standard Configuration Extension
107
- The framework provides two simple base classes that assist with existing patterns of usage to make adding in new configuration sources as easy as possible. The goal here is for the developer to either instantiate or extend these classes and produce a configuration source unique to their needs:
107
+ The framework provides two simple base classes that assist with existing patterns of usage to make adding in new configuration sources as easy as possible. The goal here is for the developer to either instantiate or extend these classes and produce a configuration source unique to their needs:
108
108
 
109
109
  **Code: Memory Provider**
110
110
  ```typescript
111
111
  import type { ConfigData } from '../parser/types.ts';
112
- import type { ConfigSource, ConfigPayload } from './types.ts';
112
+ import type { ConfigPayload, ConfigSource } from './types.ts';
113
113
 
114
114
  /**
115
115
  * Meant to be instantiated and provided as a unique config source
@@ -130,7 +130,8 @@ export class MemoryConfigSource implements ConfigSource {
130
130
  **Code: Environment JSON Provider**
131
131
  ```typescript
132
132
  import { JSONUtil } from '@travetto/runtime';
133
- import type { ConfigSource, ConfigPayload } from './types.ts';
133
+
134
+ import type { ConfigPayload, ConfigSource } from './types.ts';
134
135
 
135
136
  /**
136
137
  * Represents the environment mapped data as a JSON blob
@@ -156,11 +157,11 @@ export class EnvConfigSource implements ConfigSource {
156
157
  ```
157
158
 
158
159
  ### Custom Configuration Provider
159
- In addition to files and environment variables, configuration sources can also be provided via the class itself. This is useful for reading remote configurations, or dealing with complex configuration normalization. The only caveat to this pattern, is that the these configuration sources cannot rely on the [ConfigurationService](https://github.com/travetto/travetto/tree/main/module/config/src/service.ts#L24) service for input. This means any needed configuration will need to be accessed via specific patterns.
160
+ In addition to files and environment variables, configuration sources can also be provided via the class itself. This is useful for reading remote configurations, or dealing with complex configuration normalization. The only caveat to this pattern, is that the these configuration sources cannot rely on the [ConfigurationService](https://github.com/travetto/travetto/tree/main/module/config/src/service.ts#L24) service for input. This means any needed configuration will need to be accessed via specific patterns.
160
161
 
161
162
  **Code: Custom Configuration Source**
162
163
  ```typescript
163
- import type { ConfigSource, ConfigPayload } from '@travetto/config';
164
+ import type { ConfigPayload, ConfigSource } from '@travetto/config';
164
165
  import { Injectable } from '@travetto/di';
165
166
 
166
167
  @Injectable()
@@ -176,13 +177,13 @@ export class CustomConfigSource implements ConfigSource {
176
177
  ```
177
178
 
178
179
  ## Startup
179
- At startup, the [ConfigurationService](https://github.com/travetto/travetto/tree/main/module/config/src/service.ts#L24) service will log out all the registered configuration objects. The configuration state output is useful to determine if everything is configured properly when diagnosing runtime errors. This service will find all configurations, and output a redacted version with all secrets removed. The default pattern for secrets is `/password|private|secret/i`. More values can be added in your configuration under the path `config.secrets`. These values can either be simple strings (for exact match), or `/pattern/` to create a regular expression.
180
+ At startup, the [ConfigurationService](https://github.com/travetto/travetto/tree/main/module/config/src/service.ts#L24) service will log out all the registered configuration objects. The configuration state output is useful to determine if everything is configured properly when diagnosing runtime errors. This service will find all configurations, and output a redacted version with all secrets removed. The default pattern for secrets is `/password|private|secret/i`. More values can be added in your configuration under the path `config.secrets`. These values can either be simple strings (for exact match), or `/pattern/` to create a regular expression.
180
181
 
181
182
  ## Consuming
182
- The [ConfigurationService](https://github.com/travetto/travetto/tree/main/module/config/src/service.ts#L24) service provides injectable access to all of the loaded configuration. For simplicity, a decorator, [@Config](https://github.com/travetto/travetto/tree/main/module/config/src/decorator.ts#L13) allows for classes to automatically be bound with config information on post construction via the [Dependency Injection](https://github.com/travetto/travetto/tree/main/module/di#readme "Dependency registration/management and injection support.") module. The decorator will install a `postConstruct` method if not already defined, that performs the binding of configuration. This is due to the fact that we cannot rewrite the constructor, and order of operation matters.
183
+ The [ConfigurationService](https://github.com/travetto/travetto/tree/main/module/config/src/service.ts#L24) service provides injectable access to all of the loaded configuration. For simplicity, a decorator, [@Config](https://github.com/travetto/travetto/tree/main/module/config/src/decorator.ts#L13) allows for classes to automatically be bound with config information on post construction via the [Dependency Injection](https://github.com/travetto/travetto/tree/main/module/di#readme "Dependency registration/management and injection support.") module. The decorator will install a `postConstruct` method if not already defined, that performs the binding of configuration. This is due to the fact that we cannot rewrite the constructor, and order of operation matters.
183
184
 
184
185
  ### Environment Variables
185
- Additionally there are times in which you may want to also support configuration via environment variables. [@EnvVar](https://github.com/travetto/travetto/tree/main/module/config/src/decorator.ts#L36) supports override configuration values when environment variables are present.
186
+ Additionally there are times in which you may want to also support configuration via environment variables. [@EnvVar](https://github.com/travetto/travetto/tree/main/module/config/src/decorator.ts#L36) supports override configuration values when environment variables are present.
186
187
 
187
188
  The decorator takes in a namespace, of what part of the resolved configuration you want to bind to your class. Given the following class:
188
189
 
@@ -231,7 +232,7 @@ $ trv main doc/dbconfig-run.ts
231
232
  }
232
233
  ```
233
234
 
234
- What you see, is that the configuration structure must be honored and the application will fail to start if the constraints do not hold true. This helps to ensure that the configuration, as input to the system, is verified and correct.
235
+ What you see, is that the configuration structure must be honored and the application will fail to start if the constraints do not hold true. This helps to ensure that the configuration, as input to the system, is verified and correct.
235
236
 
236
237
  By passing in the port via the environment variable, the config will construct properly, and the application will startup correctly:
237
238
 
package/__index__.ts CHANGED
@@ -1,12 +1,13 @@
1
- import type { } from './src/trv.d.ts';
1
+ import type {} from './src/trv.d.ts';
2
+
2
3
  export * from './src/decorator.ts';
4
+ export * from './src/parser/json.ts';
5
+ export * from './src/parser/properties.ts';
6
+ export * from './src/parser/types.ts';
7
+ export * from './src/parser/yaml.ts';
3
8
  export * from './src/service.ts';
4
9
  export * from './src/source/env.ts';
5
10
  export * from './src/source/file.ts';
6
- export * from './src/parser/json.ts';
7
- export * from './src/parser/types.ts';
8
- export * from './src/parser/properties.ts';
9
- export * from './src/source/override.ts';
10
11
  export * from './src/source/memory.ts';
12
+ export * from './src/source/override.ts';
11
13
  export * from './src/source/types.ts';
12
- export * from './src/parser/yaml.ts';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@travetto/config",
3
- "version": "8.0.0-alpha.20",
3
+ "version": "8.0.0-alpha.22",
4
4
  "type": "module",
5
5
  "description": "Configuration support",
6
6
  "keywords": [
@@ -27,8 +27,8 @@
27
27
  "directory": "module/config"
28
28
  },
29
29
  "dependencies": {
30
- "@travetto/di": "^8.0.0-alpha.19",
31
- "@travetto/schema": "^8.0.0-alpha.20",
30
+ "@travetto/di": "^8.0.0-alpha.20",
31
+ "@travetto/schema": "^8.0.0-alpha.22",
32
32
  "yaml": "^2.9.0"
33
33
  },
34
34
  "travetto": {
package/src/decorator.ts CHANGED
@@ -1,9 +1,9 @@
1
- import { type Class, type ClassInstance, getClass } from '@travetto/runtime';
2
1
  import { DependencyRegistryIndex } from '@travetto/di';
2
+ import { type Class, type ClassInstance, getClass } from '@travetto/runtime';
3
3
  import { SchemaRegistryIndex } from '@travetto/schema';
4
4
 
5
- import { ConfigurationService, ConfigBaseType } from './service.ts';
6
5
  import { ConfigOverrideUtil } from './override.ts';
6
+ import { ConfigBaseType, ConfigurationService } from './service.ts';
7
7
 
8
8
  /**
9
9
  * Indicates that the given class should be populated with the configured fields, on instantiation
@@ -37,4 +37,4 @@ export function EnvVar(name: string, ...others: string[]) {
37
37
  return (instance: ClassInstance, property: string): void => {
38
38
  ConfigOverrideUtil.setOverrideConfigField(getClass(instance), property, [name, ...others]);
39
39
  };
40
- }
40
+ }
package/src/override.ts CHANGED
@@ -8,7 +8,7 @@ export const OverrideConfigSymbol = Symbol.for('@travetto/config:overrides');
8
8
  */
9
9
  export type OverrideConfig = {
10
10
  namespace?: string;
11
- fields?: Record<string, () => (unknown | undefined)>;
11
+ fields?: Record<string, () => unknown | undefined>;
12
12
  };
13
13
 
14
14
  /**
@@ -23,7 +23,7 @@ export class ConfigOverrideUtil {
23
23
  const out: Required<OverrideConfig>[] = [];
24
24
  for (const cls of SchemaRegistryIndex.getClasses()) {
25
25
  const config = this.getOverrideConfig(cls);
26
- if (config && config.fields && config.namespace) {
26
+ if (config?.fields && config.namespace) {
27
27
  out.push(asFull(config));
28
28
  }
29
29
  }
@@ -31,14 +31,12 @@ export class ConfigOverrideUtil {
31
31
  }
32
32
 
33
33
  static setOverrideConfigField(cls: Class<Any>, field: string, names: string[]): void {
34
- const env = SchemaRegistryIndex.getForRegister(cls)
35
- .registerMetadata<OverrideConfig>(OverrideConfigSymbol, {});
34
+ const env = SchemaRegistryIndex.getForRegister(cls).registerMetadata<OverrideConfig>(OverrideConfigSymbol, {});
36
35
 
37
- (env.fields ??= {})[field] = (): string | undefined =>
38
- process.env[names.find(name => !!process.env[name])!];
36
+ (env.fields ??= {})[field] = (): string | undefined => process.env[names.find(name => !!process.env[name])!];
39
37
  }
40
38
 
41
39
  static setOverrideConfig(cls: Class<Any>, namespace: string): void {
42
40
  SchemaRegistryIndex.getForRegister(cls).registerMetadata<OverrideConfig>(OverrideConfigSymbol, { namespace });
43
41
  }
44
- }
42
+ }
@@ -7,4 +7,4 @@ import type { ConfigParser } from './types.ts';
7
7
  export class JSONConfigParser implements ConfigParser {
8
8
  ext = ['.json'];
9
9
  parse = JSONUtil.fromUTF8;
10
- }
10
+ }
@@ -8,7 +8,6 @@ import type { ConfigData, ConfigParser } from './types.ts';
8
8
 
9
9
  @Injectable()
10
10
  export class ParserManager {
11
-
12
11
  #extMatch: RegExp;
13
12
  #parsers: Record<string, ConfigParser>;
14
13
 
@@ -38,4 +37,4 @@ export class ParserManager {
38
37
  matches(file: string): boolean {
39
38
  return this.#extMatch.test(file);
40
39
  }
41
- }
40
+ }
@@ -10,7 +10,6 @@ const EXCL = '!'.charCodeAt(0);
10
10
 
11
11
  @Injectable()
12
12
  export class PropertiesConfigParser implements ConfigParser {
13
-
14
13
  static parseLine(text: string): [key: string, value: string] | undefined {
15
14
  if (text.charCodeAt(0) === HASH || text.charCodeAt(0) === EXCL) {
16
15
  return;
@@ -19,11 +18,12 @@ export class PropertiesConfigParser implements ConfigParser {
19
18
  let value: string | undefined;
20
19
  for (let i = 0; i < text.length; i += 1) {
21
20
  const ch = text.charCodeAt(i);
22
- if (ch === EQUALS || ch === COLON) { // Break
21
+ if (ch === EQUALS || ch === COLON) {
22
+ // Break
23
23
  value = text.substring(i + 1).trimStart();
24
24
  break;
25
25
  } else if (ch === BACKSLASH) {
26
- key.push(text.charCodeAt(i += 1));
26
+ key.push(text.charCodeAt((i += 1)));
27
27
  } else {
28
28
  key.push(ch);
29
29
  }
@@ -42,7 +42,7 @@ export class PropertiesConfigParser implements ConfigParser {
42
42
  for (let i = 0; i < lines.length; i++) {
43
43
  let line = lines[i];
44
44
  while (i < lines.length && line.endsWith('\\')) {
45
- line = `${line.replace(/[\\]$/, '')}${lines[i += 1].trimStart()}`;
45
+ line = `${line.replace(/[\\]$/, '')}${lines[(i += 1)].trimStart()}`;
46
46
  }
47
47
  const entry = PropertiesConfigParser.parseLine(line);
48
48
  if (entry) {
@@ -51,4 +51,4 @@ export class PropertiesConfigParser implements ConfigParser {
51
51
  }
52
52
  return out;
53
53
  }
54
- }
54
+ }
@@ -1,9 +1,11 @@
1
1
  import { parse as parseYaml } from 'yaml';
2
+
2
3
  import { Injectable } from '@travetto/di';
4
+
3
5
  import type { ConfigData, ConfigParser } from './types.ts';
4
6
 
5
7
  @Injectable()
6
8
  export class YAMLConfigParser implements ConfigParser {
7
9
  ext = ['.yaml', '.yml'];
8
10
  parse = (input: string): ConfigData => parseYaml(input) ?? {};
9
- }
11
+ }
package/src/service.ts CHANGED
@@ -1,29 +1,28 @@
1
1
  import util from 'node:util';
2
2
 
3
- import { RuntimeError, toConcrete, castTo, type Class, Env, Runtime, RuntimeResources, getClass } from '@travetto/runtime';
4
3
  import { DependencyRegistryIndex, getDefaultQualifier, Injectable, PostConstruct } from '@travetto/di';
4
+ import { type Class, castTo, Env, getClass, Runtime, RuntimeError, RuntimeResources, toConcrete } from '@travetto/runtime';
5
5
  import { BindUtil, DataUtil, SchemaRegistryIndex, SchemaValidator, ValidationResultError } from '@travetto/schema';
6
6
 
7
7
  import { ParserManager } from './parser/parser.ts';
8
8
  import type { ConfigData } from './parser/types.ts';
9
- import type { ConfigSource, ConfigPayload } from './source/types.ts';
10
9
  import { FileConfigSource } from './source/file.ts';
11
10
  import { OverrideConfigSource } from './source/override.ts';
11
+ import type { ConfigPayload, ConfigSource } from './source/types.ts';
12
12
 
13
13
  type ConfigSpecSimple = Omit<ConfigPayload, 'data'>;
14
14
 
15
15
  /**
16
16
  * Common Type for all configuration classes
17
17
  */
18
- export class ConfigBaseType { }
18
+ export class ConfigBaseType {}
19
19
 
20
20
  /**
21
21
  * Manager for application configuration
22
22
  */
23
23
  @Injectable()
24
24
  export class ConfigurationService {
25
-
26
- #storage: Record<string, unknown> = {}; // Lowered, and flattened
25
+ #storage: Record<string, unknown> = {}; // Lowered, and flattened
27
26
  #payloads: ConfigSpecSimple[] = [];
28
27
  #secrets: (RegExp | string)[] = [/secure(-|_|[a-z])|password|private|secret|salt|(\bkey|key\b)|serviceAccount|(api(-|_)?key)/i];
29
28
 
@@ -32,7 +31,7 @@ export class ConfigurationService {
32
31
  * @param namespace The namespace of the config to search for, can be dotted for accessing sub namespaces
33
32
  */
34
33
  #get<T extends Record<string, unknown> = Record<string, unknown>>(namespace?: string): T {
35
- const parts = (namespace ? namespace.split('.') : []);
34
+ const parts = namespace ? namespace.split('.') : [];
36
35
  let sub: Record<string, unknown> = this.#storage;
37
36
 
38
37
  while (parts.length && sub) {
@@ -54,16 +53,16 @@ export class ConfigurationService {
54
53
  const providers = DependencyRegistryIndex.getCandidates(toConcrete<ConfigSource>());
55
54
 
56
55
  const configs = await Promise.all(
57
- providers.map(async (candidate) => await DependencyRegistryIndex.getInstance<ConfigSource>(candidate.candidateType, candidate.qualifier))
56
+ providers.map(
57
+ async candidate => await DependencyRegistryIndex.getInstance<ConfigSource>(candidate.candidateType, candidate.qualifier)
58
+ )
58
59
  );
59
60
 
60
61
  const parser = await DependencyRegistryIndex.getInstance(ParserManager);
61
62
 
62
- const possible = await Promise.all([
63
- new FileConfigSource(parser),
64
- ...configs,
65
- new OverrideConfigSource()
66
- ].map(async source => source.get()));
63
+ const possible = await Promise.all(
64
+ [new FileConfigSource(parser), ...configs, new OverrideConfigSource()].map(async source => source.get())
65
+ );
67
66
 
68
67
  const payloads = possible
69
68
  .flat()
@@ -93,7 +92,7 @@ export class ConfigurationService {
93
92
  * Export all active configuration, useful for displaying active state
94
93
  * - Will not show fields marked as secret
95
94
  */
96
- async exportActive(): Promise<{ sources: ConfigSpecSimple[], active: ConfigData }> {
95
+ async exportActive(): Promise<{ sources: ConfigSpecSimple[]; active: ConfigData }> {
97
96
  const configTargets = DependencyRegistryIndex.getCandidates(ConfigBaseType);
98
97
  const configs = await Promise.all(
99
98
  configTargets
@@ -106,9 +105,10 @@ export class ConfigurationService {
106
105
  );
107
106
  const out: Record<string, ConfigData> = {};
108
107
  for (const [candidate, inst] of configs) {
109
- const data = BindUtil.bindSchemaToObject<ConfigData>(
110
- getClass(inst), {}, inst, { filterInput: field => !('secret' in field) || !field.secret, filterValue: value => value !== undefined }
111
- );
108
+ const data = BindUtil.bindSchemaToObject<ConfigData>(getClass(inst), {}, inst, {
109
+ filterInput: field => !('secret' in field) || !field.secret,
110
+ filterValue: value => value !== undefined
111
+ });
112
112
  out[candidate.candidateType.name] = DataUtil.filterByKeys(data, this.#secrets);
113
113
  }
114
114
  return { sources: this.#payloads, active: out };
@@ -144,23 +144,26 @@ export class ConfigurationService {
144
144
  * Produce the visible configuration state and runtime information
145
145
  */
146
146
  async initBanner(): Promise<string> {
147
- return util.inspect({
148
- manifest: {
149
- main: Runtime.main,
150
- workspace: Runtime.workspace
151
- },
152
- runtime: {
153
- production: Runtime.production,
154
- role: Runtime.role,
155
- debug: Runtime.debug,
156
- resourcePaths: RuntimeResources.searchPaths,
157
- profiles: Env.TRV_PROFILES.list ?? []
147
+ return util.inspect(
148
+ {
149
+ manifest: {
150
+ main: Runtime.main,
151
+ workspace: Runtime.workspace
152
+ },
153
+ runtime: {
154
+ production: Runtime.production,
155
+ role: Runtime.role,
156
+ debug: Runtime.debug,
157
+ resourcePaths: RuntimeResources.searchPaths,
158
+ profiles: Env.TRV_PROFILES.list ?? []
159
+ },
160
+ config: await this.exportActive()
158
161
  },
159
- config: await this.exportActive()
160
- }, {
161
- ...util.inspect.defaultOptions,
162
- depth: 100,
163
- colors: false, // Colors are not useful in logs
164
- });
162
+ {
163
+ ...util.inspect.defaultOptions,
164
+ depth: 100,
165
+ colors: false // Colors are not useful in logs
166
+ }
167
+ );
165
168
  }
166
- }
169
+ }
package/src/source/env.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import { JSONUtil } from '@travetto/runtime';
2
- import type { ConfigSource, ConfigPayload } from './types.ts';
2
+
3
+ import type { ConfigPayload, ConfigSource } from './types.ts';
3
4
 
4
5
  /**
5
6
  * Represents the environment mapped data as a JSON blob
@@ -21,4 +22,4 @@ export class EnvConfigSource implements ConfigSource {
21
22
  console.error(`env.${this.#envKey} is an invalid format`, { text: process.env[this.#envKey] });
22
23
  }
23
24
  }
24
- }
25
+ }
@@ -3,8 +3,8 @@ import path from 'node:path';
3
3
 
4
4
  import { Env, Runtime, RuntimeResources } from '@travetto/runtime';
5
5
 
6
- import type { ConfigSource, ConfigPayload } from './types.ts';
7
6
  import type { ParserManager } from '../parser/parser.ts';
7
+ import type { ConfigPayload, ConfigSource } from './types.ts';
8
8
 
9
9
  type Profile = [string, number] | readonly [string, number];
10
10
 
@@ -12,11 +12,8 @@ type Profile = [string, number] | readonly [string, number];
12
12
  * File-based config source, relies on resource search paths for finding files
13
13
  */
14
14
  export class FileConfigSource implements ConfigSource {
15
-
16
15
  static getProfiles(): Profile[] {
17
- const profiles: Profile[] = [
18
- ['application', 100]
19
- ];
16
+ const profiles: Profile[] = [['application', 100]];
20
17
  if (Runtime.role === 'std') {
21
18
  if (Runtime.localDevelopment) {
22
19
  profiles.push(['local', 200]);
@@ -24,8 +21,7 @@ export class FileConfigSource implements ConfigSource {
24
21
  } else {
25
22
  profiles.push([Runtime.role, 200]);
26
23
  }
27
- profiles.push(...(Env.TRV_PROFILES.list ?? [])
28
- .map((profile, i) => [profile, 300 + i * 10] as const));
24
+ profiles.push(...(Env.TRV_PROFILES.list ?? []).map((profile, i) => [profile, 300 + i * 10] as const));
29
25
  return profiles;
30
26
  }
31
27
 
@@ -51,16 +47,18 @@ export class FileConfigSource implements ConfigSource {
51
47
  if (this.#parser.matches(file) && path.basename(file, path.extname(file)) === profile) {
52
48
  const full = path.resolve(folder, file);
53
49
  const configPriority = i++;
54
- configs.push(this.#parser.parse(full).then(data => ({
55
- data,
56
- priority: configPriority,
57
- source: `file://${profile}`,
58
- detail: Runtime.stripWorkspacePath(full)
59
- })));
50
+ configs.push(
51
+ this.#parser.parse(full).then(data => ({
52
+ data,
53
+ priority: configPriority,
54
+ source: `file://${profile}`,
55
+ detail: Runtime.stripWorkspacePath(full)
56
+ }))
57
+ );
60
58
  }
61
59
  }
62
60
  }
63
61
  }
64
62
  return Promise.all(configs);
65
63
  }
66
- }
64
+ }
@@ -1,5 +1,5 @@
1
1
  import type { ConfigData } from '../parser/types.ts';
2
- import type { ConfigSource, ConfigPayload } from './types.ts';
2
+ import type { ConfigPayload, ConfigSource } from './types.ts';
3
3
 
4
4
  /**
5
5
  * Meant to be instantiated and provided as a unique config source
@@ -14,4 +14,4 @@ export class MemoryConfigSource implements ConfigSource {
14
14
  get(): ConfigPayload {
15
15
  return this.#payload;
16
16
  }
17
- }
17
+ }
@@ -1,6 +1,6 @@
1
- import type { ConfigData } from '../parser/types.ts';
2
- import type { ConfigSource, ConfigPayload } from './types.ts';
3
1
  import { ConfigOverrideUtil } from '../override.ts';
2
+ import type { ConfigData } from '../parser/types.ts';
3
+ import type { ConfigPayload, ConfigSource } from './types.ts';
4
4
 
5
5
  /**
6
6
  * Overridable config source, provides ability to override field level values, currently used by
@@ -23,4 +23,4 @@ export class OverrideConfigSource implements ConfigSource {
23
23
  get(): ConfigPayload {
24
24
  return { data: this.#build(), priority: 999, source: 'memory://override' };
25
25
  }
26
- }
26
+ }
@@ -3,11 +3,11 @@ import type { ConfigData } from '../parser/types.ts';
3
3
  type OrProm<T> = T | Promise<T>;
4
4
  type OneOf<T> = T[] | T | undefined;
5
5
 
6
- export type ConfigPayload = { data: ConfigData, priority: number, source: string, detail?: string };
6
+ export type ConfigPayload = { data: ConfigData; priority: number; source: string; detail?: string };
7
7
 
8
8
  /**
9
9
  * @concrete
10
10
  */
11
11
  export interface ConfigSource {
12
12
  get(): OrProm<OneOf<ConfigPayload>>;
13
- }
13
+ }