@travetto/config 7.0.0-rc.2 → 7.0.0-rc.3

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
@@ -124,6 +124,7 @@ export class MemoryConfigSource implements ConfigSource {
124
124
 
125
125
  **Code: Environment JSON Provider**
126
126
  ```typescript
127
+ import { JSONUtil } from '@travetto/runtime';
127
128
  import { ConfigSource, ConfigPayload } from './types.ts';
128
129
 
129
130
  /**
@@ -140,7 +141,7 @@ export class EnvConfigSource implements ConfigSource {
140
141
 
141
142
  get(): ConfigPayload | undefined {
142
143
  try {
143
- const data = JSON.parse(process.env[this.#envKey] || '{}');
144
+ const data: Record<string, unknown> = JSONUtil.parseSafe(process.env[this.#envKey] || '{}');
144
145
  return { data, priority: this.#priority, source: `env://${this.#envKey}` };
145
146
  } catch {
146
147
  console.error(`env.${this.#envKey} is an invalid format`, { text: process.env[this.#envKey] });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@travetto/config",
3
- "version": "7.0.0-rc.2",
3
+ "version": "7.0.0-rc.3",
4
4
  "description": "Configuration support",
5
5
  "keywords": [
6
6
  "yaml",
@@ -26,8 +26,8 @@
26
26
  "directory": "module/config"
27
27
  },
28
28
  "dependencies": {
29
- "@travetto/di": "^7.0.0-rc.2",
30
- "@travetto/schema": "^7.0.0-rc.2",
29
+ "@travetto/di": "^7.0.0-rc.3",
30
+ "@travetto/schema": "^7.0.0-rc.3",
31
31
  "yaml": "^2.8.1"
32
32
  },
33
33
  "travetto": {
@@ -1,9 +1,10 @@
1
1
  import { Injectable } from '@travetto/di';
2
+ import { JSONUtil } from '@travetto/runtime';
2
3
 
3
4
  import { ConfigParser } from './types.ts';
4
5
 
5
6
  @Injectable()
6
7
  export class JSONConfigParser implements ConfigParser {
7
8
  ext = ['.json'];
8
- parse = JSON.parse.bind(JSON);
9
+ parse = JSONUtil.parseSafe;
9
10
  }
package/src/service.ts CHANGED
@@ -152,7 +152,6 @@ export class ConfigurationService {
152
152
  env: Runtime.env,
153
153
  debug: Runtime.debug,
154
154
  production: Runtime.production,
155
- dynamic: Runtime.dynamic,
156
155
  resourcePaths: RuntimeResources.searchPaths,
157
156
  profiles: Env.TRV_PROFILES.list ?? []
158
157
  },
package/src/source/env.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import { JSONUtil } from '@travetto/runtime';
1
2
  import { ConfigSource, ConfigPayload } from './types.ts';
2
3
 
3
4
  /**
@@ -14,7 +15,7 @@ export class EnvConfigSource implements ConfigSource {
14
15
 
15
16
  get(): ConfigPayload | undefined {
16
17
  try {
17
- const data = JSON.parse(process.env[this.#envKey] || '{}');
18
+ const data: Record<string, unknown> = JSONUtil.parseSafe(process.env[this.#envKey] || '{}');
18
19
  return { data, priority: this.#priority, source: `env://${this.#envKey}` };
19
20
  } catch {
20
21
  console.error(`env.${this.#envKey} is an invalid format`, { text: process.env[this.#envKey] });