@lorion-org/runtime-config 1.0.0-beta.0
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/LICENSE +21 -0
- package/README.md +309 -0
- package/dist/index.cjs +368 -0
- package/dist/index.d.cts +101 -0
- package/dist/index.d.ts +101 -0
- package/dist/index.js +319 -0
- package/examples/context-input-key.ts +46 -0
- package/examples/env-vars.ts +25 -0
- package/examples/namespaced-runtime-config.ts +50 -0
- package/examples/scope-view.ts +32 -0
- package/examples/sectioned-runtime-config.ts +52 -0
- package/package.json +58 -0
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
type RuntimeConfigKeyStrategy = (scopeId: string, key: string) => string;
|
|
2
|
+
type RuntimeConfigKeyOptions = {
|
|
3
|
+
keyStrategy?: RuntimeConfigKeyStrategy;
|
|
4
|
+
};
|
|
5
|
+
declare function createRuntimeConfigKey(scopeId: string, key: string, options?: RuntimeConfigKeyOptions): string;
|
|
6
|
+
declare function stripRuntimeConfigScopePrefix(scopeId: string, configKey: string, options?: RuntimeConfigKeyOptions): string | undefined;
|
|
7
|
+
declare function toSnakeUpperCase(input: string): string;
|
|
8
|
+
|
|
9
|
+
type ConfigVisibility = 'public' | 'private';
|
|
10
|
+
type RuntimeConfigSection = Record<string, unknown>;
|
|
11
|
+
type RuntimeConfigContext = {
|
|
12
|
+
public?: RuntimeConfigSection;
|
|
13
|
+
private?: RuntimeConfigSection;
|
|
14
|
+
};
|
|
15
|
+
type RuntimeConfigFragment = RuntimeConfigContext & {
|
|
16
|
+
contexts?: Record<string, RuntimeConfigContext>;
|
|
17
|
+
};
|
|
18
|
+
type RuntimeConfigFragmentInput = RuntimeConfigFragment & Record<string, unknown>;
|
|
19
|
+
type NamedRuntimeConfigFragment = {
|
|
20
|
+
scopeId: string;
|
|
21
|
+
config: RuntimeConfigFragmentInput;
|
|
22
|
+
};
|
|
23
|
+
type RuntimeConfigFragmentMap = Map<string, RuntimeConfigFragment>;
|
|
24
|
+
type SectionedRuntimeConfig = {
|
|
25
|
+
public: RuntimeConfigSection;
|
|
26
|
+
private: RuntimeConfigSection;
|
|
27
|
+
};
|
|
28
|
+
type RuntimeConfigNamespaceProjection = RuntimeConfigSection & {
|
|
29
|
+
public: RuntimeConfigSection;
|
|
30
|
+
};
|
|
31
|
+
type RuntimeEnvVars = Record<string, unknown>;
|
|
32
|
+
declare const runtimeConfigVisibilities: ConfigVisibility[];
|
|
33
|
+
|
|
34
|
+
type NormalizeRuntimeConfigFragmentOptions = {
|
|
35
|
+
contextInputKey?: string;
|
|
36
|
+
};
|
|
37
|
+
declare function toRuntimeConfigFragment(config: RuntimeConfigFragmentInput, options?: NormalizeRuntimeConfigFragmentOptions): RuntimeConfigFragment;
|
|
38
|
+
|
|
39
|
+
type ProjectSectionedRuntimeConfigOptions = RuntimeConfigKeyOptions & NormalizeRuntimeConfigFragmentOptions & {
|
|
40
|
+
contextOutputKey?: string;
|
|
41
|
+
includeContexts?: boolean;
|
|
42
|
+
scopeIds?: string[];
|
|
43
|
+
};
|
|
44
|
+
type ProjectRuntimeConfigFragmentOptions = Omit<ProjectSectionedRuntimeConfigOptions, 'scopeIds'>;
|
|
45
|
+
type ProjectRuntimeConfigNamespacesOptions = {
|
|
46
|
+
contextInputKey?: string;
|
|
47
|
+
contextId?: string;
|
|
48
|
+
namespaceStrategy?: 'nested' | 'flat';
|
|
49
|
+
scopeIds?: string[];
|
|
50
|
+
};
|
|
51
|
+
type ProjectRuntimeConfigNamespaceOptions = Omit<ProjectRuntimeConfigNamespacesOptions, 'scopeIds'>;
|
|
52
|
+
declare function normalizeRuntimeConfigFragments(fragments: Iterable<NamedRuntimeConfigFragment> | RuntimeConfigFragmentMap, options?: NormalizeRuntimeConfigFragmentOptions): NamedRuntimeConfigFragment[];
|
|
53
|
+
declare function projectSectionedRuntimeConfig(fragments: Iterable<NamedRuntimeConfigFragment> | RuntimeConfigFragmentMap, options?: ProjectSectionedRuntimeConfigOptions): SectionedRuntimeConfig;
|
|
54
|
+
declare function projectRuntimeConfigFragment(scopeId: string, config: RuntimeConfigFragment, options?: ProjectRuntimeConfigFragmentOptions): SectionedRuntimeConfig;
|
|
55
|
+
declare function projectRuntimeConfigNamespace(scopeId: string, config: RuntimeConfigFragment, options?: ProjectRuntimeConfigNamespaceOptions): RuntimeConfigNamespaceProjection;
|
|
56
|
+
declare function projectRuntimeConfigNamespaces(fragments: Iterable<NamedRuntimeConfigFragment> | RuntimeConfigFragmentMap, options?: ProjectRuntimeConfigNamespacesOptions): RuntimeConfigNamespaceProjection;
|
|
57
|
+
|
|
58
|
+
type ProjectRuntimeConfigEnvVarsOptions = ProjectSectionedRuntimeConfigOptions & {
|
|
59
|
+
prefix?: string;
|
|
60
|
+
};
|
|
61
|
+
declare function createRuntimeConfigEnvKey(input: {
|
|
62
|
+
key: string;
|
|
63
|
+
prefix?: string;
|
|
64
|
+
scopeId?: string;
|
|
65
|
+
visibility?: ConfigVisibility;
|
|
66
|
+
}): string;
|
|
67
|
+
declare function toRuntimeEnvVars(runtimeConfig: SectionedRuntimeConfig, prefix?: string): RuntimeEnvVars;
|
|
68
|
+
declare function projectRuntimeConfigEnvVars(fragments: Iterable<NamedRuntimeConfigFragment> | RuntimeConfigFragmentMap, options?: ProjectRuntimeConfigEnvVarsOptions): RuntimeEnvVars;
|
|
69
|
+
declare function injectRuntimeEnvVars(envVars: RuntimeEnvVars, processEnv: Record<string, unknown>): RuntimeEnvVars;
|
|
70
|
+
declare function runtimeEnvVarsToString(envVars: RuntimeEnvVars): string;
|
|
71
|
+
declare function runtimeEnvValueToShellLiteral(value: unknown): string;
|
|
72
|
+
declare function runtimeEnvVarsToShellAssignments(envVars: RuntimeEnvVars): string;
|
|
73
|
+
|
|
74
|
+
type ResolveRuntimeConfigValueOptions<T = unknown> = RuntimeConfigKeyOptions & {
|
|
75
|
+
contextId?: string;
|
|
76
|
+
contextOutputKey?: string;
|
|
77
|
+
defaultValue?: T;
|
|
78
|
+
};
|
|
79
|
+
type ResolveRuntimeConfigValueFromRuntimeConfigOptions<T = unknown> = ResolveRuntimeConfigValueOptions<T> & {
|
|
80
|
+
visibility?: ConfigVisibility;
|
|
81
|
+
};
|
|
82
|
+
declare function resolveRuntimeConfigValue<T = unknown>(scopeConfig: RuntimeConfigSection | undefined, scopeId: string, key: string, options?: ResolveRuntimeConfigValueOptions<T>): T | undefined;
|
|
83
|
+
declare function resolveRuntimeConfigValueFromRuntimeConfig<T = unknown>(runtimeConfig: Partial<Record<ConfigVisibility, RuntimeConfigSection | undefined>>, scopeId: string, key: string, options?: ResolveRuntimeConfigValueFromRuntimeConfigOptions<T>): T | undefined;
|
|
84
|
+
|
|
85
|
+
type GetRuntimeConfigScopeOptions = RuntimeConfigKeyOptions & {
|
|
86
|
+
contextId?: string;
|
|
87
|
+
contextOutputKey?: string;
|
|
88
|
+
keys?: string[];
|
|
89
|
+
visibility?: ConfigVisibility;
|
|
90
|
+
};
|
|
91
|
+
type GetRuntimeConfigFragmentOptions = RuntimeConfigKeyOptions & {
|
|
92
|
+
contextId?: string;
|
|
93
|
+
contextOutputKey?: string;
|
|
94
|
+
keys?: Partial<Record<ConfigVisibility, string[]>>;
|
|
95
|
+
};
|
|
96
|
+
declare function getRuntimeConfigScope<T extends RuntimeConfigSection = RuntimeConfigSection>(runtimeConfig: Partial<Record<ConfigVisibility, RuntimeConfigSection | undefined>>, scopeId: string, options?: GetRuntimeConfigScopeOptions): T;
|
|
97
|
+
declare function getPublicRuntimeConfigScope<T extends RuntimeConfigSection = RuntimeConfigSection>(runtimeConfig: Partial<Record<ConfigVisibility, RuntimeConfigSection | undefined>>, scopeId: string, options?: Omit<GetRuntimeConfigScopeOptions, 'visibility'>): T;
|
|
98
|
+
declare function getPrivateRuntimeConfigScope<T extends RuntimeConfigSection = RuntimeConfigSection>(runtimeConfig: Partial<Record<ConfigVisibility, RuntimeConfigSection | undefined>>, scopeId: string, options?: Omit<GetRuntimeConfigScopeOptions, 'visibility'>): T;
|
|
99
|
+
declare function getRuntimeConfigFragment(runtimeConfig: Partial<Record<ConfigVisibility, RuntimeConfigSection | undefined>>, scopeId: string, options?: GetRuntimeConfigFragmentOptions): RuntimeConfigContext;
|
|
100
|
+
|
|
101
|
+
export { type ConfigVisibility, type GetRuntimeConfigFragmentOptions, type GetRuntimeConfigScopeOptions, type NamedRuntimeConfigFragment, type NormalizeRuntimeConfigFragmentOptions, type ProjectRuntimeConfigEnvVarsOptions, type ProjectRuntimeConfigFragmentOptions, type ProjectRuntimeConfigNamespaceOptions, type ProjectRuntimeConfigNamespacesOptions, type ProjectSectionedRuntimeConfigOptions, type ResolveRuntimeConfigValueFromRuntimeConfigOptions, type ResolveRuntimeConfigValueOptions, type RuntimeConfigContext, type RuntimeConfigFragment, type RuntimeConfigFragmentInput, type RuntimeConfigFragmentMap, type RuntimeConfigKeyOptions, type RuntimeConfigKeyStrategy, type RuntimeConfigNamespaceProjection, type RuntimeConfigSection, type RuntimeEnvVars, type SectionedRuntimeConfig, createRuntimeConfigEnvKey, createRuntimeConfigKey, getPrivateRuntimeConfigScope, getPublicRuntimeConfigScope, getRuntimeConfigFragment, getRuntimeConfigScope, injectRuntimeEnvVars, normalizeRuntimeConfigFragments, projectRuntimeConfigEnvVars, projectRuntimeConfigFragment, projectRuntimeConfigNamespace, projectRuntimeConfigNamespaces, projectSectionedRuntimeConfig, resolveRuntimeConfigValue, resolveRuntimeConfigValueFromRuntimeConfig, runtimeConfigVisibilities, runtimeEnvValueToShellLiteral, runtimeEnvVarsToShellAssignments, runtimeEnvVarsToString, stripRuntimeConfigScopePrefix, toRuntimeConfigFragment, toRuntimeEnvVars, toSnakeUpperCase };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
type RuntimeConfigKeyStrategy = (scopeId: string, key: string) => string;
|
|
2
|
+
type RuntimeConfigKeyOptions = {
|
|
3
|
+
keyStrategy?: RuntimeConfigKeyStrategy;
|
|
4
|
+
};
|
|
5
|
+
declare function createRuntimeConfigKey(scopeId: string, key: string, options?: RuntimeConfigKeyOptions): string;
|
|
6
|
+
declare function stripRuntimeConfigScopePrefix(scopeId: string, configKey: string, options?: RuntimeConfigKeyOptions): string | undefined;
|
|
7
|
+
declare function toSnakeUpperCase(input: string): string;
|
|
8
|
+
|
|
9
|
+
type ConfigVisibility = 'public' | 'private';
|
|
10
|
+
type RuntimeConfigSection = Record<string, unknown>;
|
|
11
|
+
type RuntimeConfigContext = {
|
|
12
|
+
public?: RuntimeConfigSection;
|
|
13
|
+
private?: RuntimeConfigSection;
|
|
14
|
+
};
|
|
15
|
+
type RuntimeConfigFragment = RuntimeConfigContext & {
|
|
16
|
+
contexts?: Record<string, RuntimeConfigContext>;
|
|
17
|
+
};
|
|
18
|
+
type RuntimeConfigFragmentInput = RuntimeConfigFragment & Record<string, unknown>;
|
|
19
|
+
type NamedRuntimeConfigFragment = {
|
|
20
|
+
scopeId: string;
|
|
21
|
+
config: RuntimeConfigFragmentInput;
|
|
22
|
+
};
|
|
23
|
+
type RuntimeConfigFragmentMap = Map<string, RuntimeConfigFragment>;
|
|
24
|
+
type SectionedRuntimeConfig = {
|
|
25
|
+
public: RuntimeConfigSection;
|
|
26
|
+
private: RuntimeConfigSection;
|
|
27
|
+
};
|
|
28
|
+
type RuntimeConfigNamespaceProjection = RuntimeConfigSection & {
|
|
29
|
+
public: RuntimeConfigSection;
|
|
30
|
+
};
|
|
31
|
+
type RuntimeEnvVars = Record<string, unknown>;
|
|
32
|
+
declare const runtimeConfigVisibilities: ConfigVisibility[];
|
|
33
|
+
|
|
34
|
+
type NormalizeRuntimeConfigFragmentOptions = {
|
|
35
|
+
contextInputKey?: string;
|
|
36
|
+
};
|
|
37
|
+
declare function toRuntimeConfigFragment(config: RuntimeConfigFragmentInput, options?: NormalizeRuntimeConfigFragmentOptions): RuntimeConfigFragment;
|
|
38
|
+
|
|
39
|
+
type ProjectSectionedRuntimeConfigOptions = RuntimeConfigKeyOptions & NormalizeRuntimeConfigFragmentOptions & {
|
|
40
|
+
contextOutputKey?: string;
|
|
41
|
+
includeContexts?: boolean;
|
|
42
|
+
scopeIds?: string[];
|
|
43
|
+
};
|
|
44
|
+
type ProjectRuntimeConfigFragmentOptions = Omit<ProjectSectionedRuntimeConfigOptions, 'scopeIds'>;
|
|
45
|
+
type ProjectRuntimeConfigNamespacesOptions = {
|
|
46
|
+
contextInputKey?: string;
|
|
47
|
+
contextId?: string;
|
|
48
|
+
namespaceStrategy?: 'nested' | 'flat';
|
|
49
|
+
scopeIds?: string[];
|
|
50
|
+
};
|
|
51
|
+
type ProjectRuntimeConfigNamespaceOptions = Omit<ProjectRuntimeConfigNamespacesOptions, 'scopeIds'>;
|
|
52
|
+
declare function normalizeRuntimeConfigFragments(fragments: Iterable<NamedRuntimeConfigFragment> | RuntimeConfigFragmentMap, options?: NormalizeRuntimeConfigFragmentOptions): NamedRuntimeConfigFragment[];
|
|
53
|
+
declare function projectSectionedRuntimeConfig(fragments: Iterable<NamedRuntimeConfigFragment> | RuntimeConfigFragmentMap, options?: ProjectSectionedRuntimeConfigOptions): SectionedRuntimeConfig;
|
|
54
|
+
declare function projectRuntimeConfigFragment(scopeId: string, config: RuntimeConfigFragment, options?: ProjectRuntimeConfigFragmentOptions): SectionedRuntimeConfig;
|
|
55
|
+
declare function projectRuntimeConfigNamespace(scopeId: string, config: RuntimeConfigFragment, options?: ProjectRuntimeConfigNamespaceOptions): RuntimeConfigNamespaceProjection;
|
|
56
|
+
declare function projectRuntimeConfigNamespaces(fragments: Iterable<NamedRuntimeConfigFragment> | RuntimeConfigFragmentMap, options?: ProjectRuntimeConfigNamespacesOptions): RuntimeConfigNamespaceProjection;
|
|
57
|
+
|
|
58
|
+
type ProjectRuntimeConfigEnvVarsOptions = ProjectSectionedRuntimeConfigOptions & {
|
|
59
|
+
prefix?: string;
|
|
60
|
+
};
|
|
61
|
+
declare function createRuntimeConfigEnvKey(input: {
|
|
62
|
+
key: string;
|
|
63
|
+
prefix?: string;
|
|
64
|
+
scopeId?: string;
|
|
65
|
+
visibility?: ConfigVisibility;
|
|
66
|
+
}): string;
|
|
67
|
+
declare function toRuntimeEnvVars(runtimeConfig: SectionedRuntimeConfig, prefix?: string): RuntimeEnvVars;
|
|
68
|
+
declare function projectRuntimeConfigEnvVars(fragments: Iterable<NamedRuntimeConfigFragment> | RuntimeConfigFragmentMap, options?: ProjectRuntimeConfigEnvVarsOptions): RuntimeEnvVars;
|
|
69
|
+
declare function injectRuntimeEnvVars(envVars: RuntimeEnvVars, processEnv: Record<string, unknown>): RuntimeEnvVars;
|
|
70
|
+
declare function runtimeEnvVarsToString(envVars: RuntimeEnvVars): string;
|
|
71
|
+
declare function runtimeEnvValueToShellLiteral(value: unknown): string;
|
|
72
|
+
declare function runtimeEnvVarsToShellAssignments(envVars: RuntimeEnvVars): string;
|
|
73
|
+
|
|
74
|
+
type ResolveRuntimeConfigValueOptions<T = unknown> = RuntimeConfigKeyOptions & {
|
|
75
|
+
contextId?: string;
|
|
76
|
+
contextOutputKey?: string;
|
|
77
|
+
defaultValue?: T;
|
|
78
|
+
};
|
|
79
|
+
type ResolveRuntimeConfigValueFromRuntimeConfigOptions<T = unknown> = ResolveRuntimeConfigValueOptions<T> & {
|
|
80
|
+
visibility?: ConfigVisibility;
|
|
81
|
+
};
|
|
82
|
+
declare function resolveRuntimeConfigValue<T = unknown>(scopeConfig: RuntimeConfigSection | undefined, scopeId: string, key: string, options?: ResolveRuntimeConfigValueOptions<T>): T | undefined;
|
|
83
|
+
declare function resolveRuntimeConfigValueFromRuntimeConfig<T = unknown>(runtimeConfig: Partial<Record<ConfigVisibility, RuntimeConfigSection | undefined>>, scopeId: string, key: string, options?: ResolveRuntimeConfigValueFromRuntimeConfigOptions<T>): T | undefined;
|
|
84
|
+
|
|
85
|
+
type GetRuntimeConfigScopeOptions = RuntimeConfigKeyOptions & {
|
|
86
|
+
contextId?: string;
|
|
87
|
+
contextOutputKey?: string;
|
|
88
|
+
keys?: string[];
|
|
89
|
+
visibility?: ConfigVisibility;
|
|
90
|
+
};
|
|
91
|
+
type GetRuntimeConfigFragmentOptions = RuntimeConfigKeyOptions & {
|
|
92
|
+
contextId?: string;
|
|
93
|
+
contextOutputKey?: string;
|
|
94
|
+
keys?: Partial<Record<ConfigVisibility, string[]>>;
|
|
95
|
+
};
|
|
96
|
+
declare function getRuntimeConfigScope<T extends RuntimeConfigSection = RuntimeConfigSection>(runtimeConfig: Partial<Record<ConfigVisibility, RuntimeConfigSection | undefined>>, scopeId: string, options?: GetRuntimeConfigScopeOptions): T;
|
|
97
|
+
declare function getPublicRuntimeConfigScope<T extends RuntimeConfigSection = RuntimeConfigSection>(runtimeConfig: Partial<Record<ConfigVisibility, RuntimeConfigSection | undefined>>, scopeId: string, options?: Omit<GetRuntimeConfigScopeOptions, 'visibility'>): T;
|
|
98
|
+
declare function getPrivateRuntimeConfigScope<T extends RuntimeConfigSection = RuntimeConfigSection>(runtimeConfig: Partial<Record<ConfigVisibility, RuntimeConfigSection | undefined>>, scopeId: string, options?: Omit<GetRuntimeConfigScopeOptions, 'visibility'>): T;
|
|
99
|
+
declare function getRuntimeConfigFragment(runtimeConfig: Partial<Record<ConfigVisibility, RuntimeConfigSection | undefined>>, scopeId: string, options?: GetRuntimeConfigFragmentOptions): RuntimeConfigContext;
|
|
100
|
+
|
|
101
|
+
export { type ConfigVisibility, type GetRuntimeConfigFragmentOptions, type GetRuntimeConfigScopeOptions, type NamedRuntimeConfigFragment, type NormalizeRuntimeConfigFragmentOptions, type ProjectRuntimeConfigEnvVarsOptions, type ProjectRuntimeConfigFragmentOptions, type ProjectRuntimeConfigNamespaceOptions, type ProjectRuntimeConfigNamespacesOptions, type ProjectSectionedRuntimeConfigOptions, type ResolveRuntimeConfigValueFromRuntimeConfigOptions, type ResolveRuntimeConfigValueOptions, type RuntimeConfigContext, type RuntimeConfigFragment, type RuntimeConfigFragmentInput, type RuntimeConfigFragmentMap, type RuntimeConfigKeyOptions, type RuntimeConfigKeyStrategy, type RuntimeConfigNamespaceProjection, type RuntimeConfigSection, type RuntimeEnvVars, type SectionedRuntimeConfig, createRuntimeConfigEnvKey, createRuntimeConfigKey, getPrivateRuntimeConfigScope, getPublicRuntimeConfigScope, getRuntimeConfigFragment, getRuntimeConfigScope, injectRuntimeEnvVars, normalizeRuntimeConfigFragments, projectRuntimeConfigEnvVars, projectRuntimeConfigFragment, projectRuntimeConfigNamespace, projectRuntimeConfigNamespaces, projectSectionedRuntimeConfig, resolveRuntimeConfigValue, resolveRuntimeConfigValueFromRuntimeConfig, runtimeConfigVisibilities, runtimeEnvValueToShellLiteral, runtimeEnvVarsToShellAssignments, runtimeEnvVarsToString, stripRuntimeConfigScopePrefix, toRuntimeConfigFragment, toRuntimeEnvVars, toSnakeUpperCase };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,319 @@
|
|
|
1
|
+
// src/key.ts
|
|
2
|
+
function upperFirst(input) {
|
|
3
|
+
return input ? input[0].toUpperCase() + input.slice(1) : input;
|
|
4
|
+
}
|
|
5
|
+
function uncapitalize(input) {
|
|
6
|
+
return input ? input[0].toLowerCase() + input.slice(1) : input;
|
|
7
|
+
}
|
|
8
|
+
function camelCase(input) {
|
|
9
|
+
return input.replace(/['\u2019]/g, "").split(/[^A-Za-z0-9]+|(?=[A-Z][a-z])/).map((part) => part.trim()).filter(Boolean).map((part) => part.toLowerCase()).map((part, index) => index === 0 ? part : upperFirst(part)).join("");
|
|
10
|
+
}
|
|
11
|
+
function createRuntimeConfigKey(scopeId, key, options = {}) {
|
|
12
|
+
return options.keyStrategy?.(scopeId, key) ?? camelCase(`${scopeId} ${key}`);
|
|
13
|
+
}
|
|
14
|
+
function stripRuntimeConfigScopePrefix(scopeId, configKey, options = {}) {
|
|
15
|
+
const prefix = createRuntimeConfigKey(scopeId, "", options);
|
|
16
|
+
if (!prefix || !configKey.startsWith(prefix) || configKey.length <= prefix.length) {
|
|
17
|
+
return void 0;
|
|
18
|
+
}
|
|
19
|
+
return uncapitalize(configKey.slice(prefix.length));
|
|
20
|
+
}
|
|
21
|
+
function toSnakeUpperCase(input) {
|
|
22
|
+
return input.replace(/([a-z0-9])([A-Z])/g, "$1_$2").replace(/[^a-zA-Z0-9]+/g, "_").replace(/_+/g, "_").replace(/^_|_$/g, "").toUpperCase();
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
// src/fragment.ts
|
|
26
|
+
var isObject = (value) => {
|
|
27
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
28
|
+
};
|
|
29
|
+
function toRuntimeConfigFragment(config, options = {}) {
|
|
30
|
+
const contextInputKey = options.contextInputKey ?? "contexts";
|
|
31
|
+
const contexts = contextInputKey === "contexts" ? config.contexts : config.contexts ?? config[contextInputKey];
|
|
32
|
+
return {
|
|
33
|
+
...isObject(config.public) ? { public: config.public } : {},
|
|
34
|
+
...isObject(config.private) ? { private: config.private } : {},
|
|
35
|
+
...isObject(contexts) ? { contexts } : {}
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
// src/types.ts
|
|
40
|
+
var runtimeConfigVisibilities = ["public", "private"];
|
|
41
|
+
|
|
42
|
+
// src/project.ts
|
|
43
|
+
function normalizeRuntimeConfigFragments(fragments, options = {}) {
|
|
44
|
+
const entries = fragments instanceof Map ? Array.from(fragments.entries()).map(([scopeId, config]) => ({ scopeId, config })) : Array.from(fragments);
|
|
45
|
+
return entries.map((fragment) => ({
|
|
46
|
+
scopeId: fragment.scopeId.trim(),
|
|
47
|
+
config: toRuntimeConfigFragment(fragment.config, options)
|
|
48
|
+
})).filter((fragment) => fragment.scopeId.length > 0).sort((left, right) => left.scopeId.localeCompare(right.scopeId));
|
|
49
|
+
}
|
|
50
|
+
function filterFragments(input) {
|
|
51
|
+
const scopeIdSet = input.scopeIds ? new Set(input.scopeIds.map((id) => id.trim()).filter(Boolean)) : void 0;
|
|
52
|
+
return normalizeRuntimeConfigFragments(input.fragments, {
|
|
53
|
+
...input.contextInputKey ? { contextInputKey: input.contextInputKey } : {}
|
|
54
|
+
}).filter((fragment) => !scopeIdSet || scopeIdSet.has(fragment.scopeId));
|
|
55
|
+
}
|
|
56
|
+
function getSection(config, visibility) {
|
|
57
|
+
return config?.[visibility];
|
|
58
|
+
}
|
|
59
|
+
function assignDefined(target, key, value) {
|
|
60
|
+
if (value !== void 0) {
|
|
61
|
+
target[key] = value;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
function projectSectionedRuntimeConfig(fragments, options = {}) {
|
|
65
|
+
const result = {
|
|
66
|
+
public: {},
|
|
67
|
+
private: {}
|
|
68
|
+
};
|
|
69
|
+
const contextOutputKey = options.contextOutputKey ?? "__contexts";
|
|
70
|
+
const filteredFragments = filterFragments({
|
|
71
|
+
fragments,
|
|
72
|
+
...options.contextInputKey ? { contextInputKey: options.contextInputKey } : {},
|
|
73
|
+
...options.scopeIds ? { scopeIds: options.scopeIds } : {}
|
|
74
|
+
});
|
|
75
|
+
for (const fragment of filteredFragments) {
|
|
76
|
+
for (const visibility of runtimeConfigVisibilities) {
|
|
77
|
+
const section = getSection(fragment.config, visibility);
|
|
78
|
+
if (!section) continue;
|
|
79
|
+
for (const [key, value] of Object.entries(section)) {
|
|
80
|
+
assignDefined(
|
|
81
|
+
result[visibility],
|
|
82
|
+
createRuntimeConfigKey(fragment.scopeId, key, options),
|
|
83
|
+
value
|
|
84
|
+
);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
if (options.includeContexts === false) continue;
|
|
88
|
+
for (const [contextId, context] of Object.entries(fragment.config.contexts ?? {})) {
|
|
89
|
+
for (const visibility of runtimeConfigVisibilities) {
|
|
90
|
+
const section = getSection(context, visibility);
|
|
91
|
+
if (!section) continue;
|
|
92
|
+
const contexts = result[visibility][contextOutputKey] ?? {};
|
|
93
|
+
const contextValues = contexts[contextId] ?? {};
|
|
94
|
+
for (const [key, value] of Object.entries(section)) {
|
|
95
|
+
assignDefined(
|
|
96
|
+
contextValues,
|
|
97
|
+
createRuntimeConfigKey(fragment.scopeId, key, options),
|
|
98
|
+
value
|
|
99
|
+
);
|
|
100
|
+
}
|
|
101
|
+
contexts[contextId] = contextValues;
|
|
102
|
+
result[visibility][contextOutputKey] = contexts;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
return result;
|
|
107
|
+
}
|
|
108
|
+
function projectRuntimeConfigFragment(scopeId, config, options = {}) {
|
|
109
|
+
return projectSectionedRuntimeConfig(/* @__PURE__ */ new Map([[scopeId, config]]), options);
|
|
110
|
+
}
|
|
111
|
+
function projectRuntimeConfigNamespace(scopeId, config, options = {}) {
|
|
112
|
+
return projectRuntimeConfigNamespaces([{ scopeId, config }], options);
|
|
113
|
+
}
|
|
114
|
+
function projectRuntimeConfigNamespaces(fragments, options = {}) {
|
|
115
|
+
const result = {
|
|
116
|
+
public: {}
|
|
117
|
+
};
|
|
118
|
+
const namespaceStrategy = options.namespaceStrategy ?? "nested";
|
|
119
|
+
const filteredFragments = filterFragments({
|
|
120
|
+
fragments,
|
|
121
|
+
...options.contextInputKey ? { contextInputKey: options.contextInputKey } : {},
|
|
122
|
+
...options.scopeIds ? { scopeIds: options.scopeIds } : {}
|
|
123
|
+
});
|
|
124
|
+
for (const fragment of filteredFragments) {
|
|
125
|
+
const context = options.contextId ? fragment.config.contexts?.[options.contextId] : void 0;
|
|
126
|
+
const publicSection = {
|
|
127
|
+
...fragment.config.public ?? {},
|
|
128
|
+
...context?.public ?? {}
|
|
129
|
+
};
|
|
130
|
+
const privateSection = {
|
|
131
|
+
...fragment.config.private ?? {},
|
|
132
|
+
...context?.private ?? {}
|
|
133
|
+
};
|
|
134
|
+
if (namespaceStrategy === "flat") {
|
|
135
|
+
Object.assign(result.public, publicSection);
|
|
136
|
+
Object.assign(result, privateSection);
|
|
137
|
+
continue;
|
|
138
|
+
}
|
|
139
|
+
if (Object.keys(publicSection).length) {
|
|
140
|
+
result.public[fragment.scopeId] = {
|
|
141
|
+
...result.public[fragment.scopeId] ?? {},
|
|
142
|
+
...publicSection
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
if (Object.keys(privateSection).length) {
|
|
146
|
+
result[fragment.scopeId] = {
|
|
147
|
+
...result[fragment.scopeId] ?? {},
|
|
148
|
+
...privateSection
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
return result;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
// src/env.ts
|
|
156
|
+
function createRuntimeConfigEnvKey(input) {
|
|
157
|
+
return toSnakeUpperCase(
|
|
158
|
+
[input.prefix ?? "APP", input.visibility, input.scopeId, input.key].filter(Boolean).join("_")
|
|
159
|
+
);
|
|
160
|
+
}
|
|
161
|
+
function toRuntimeEnvVars(runtimeConfig, prefix = "APP") {
|
|
162
|
+
const envVars = {};
|
|
163
|
+
for (const visibility of runtimeConfigVisibilities) {
|
|
164
|
+
for (const [key, value] of Object.entries(runtimeConfig[visibility])) {
|
|
165
|
+
if (key.startsWith("__")) continue;
|
|
166
|
+
envVars[createRuntimeConfigEnvKey({ prefix, visibility, key })] = value;
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
return envVars;
|
|
170
|
+
}
|
|
171
|
+
function projectRuntimeConfigEnvVars(fragments, options = {}) {
|
|
172
|
+
const { prefix = "APP", ...projectOptions } = options;
|
|
173
|
+
return toRuntimeEnvVars(
|
|
174
|
+
projectSectionedRuntimeConfig(fragments, {
|
|
175
|
+
...projectOptions,
|
|
176
|
+
includeContexts: false
|
|
177
|
+
}),
|
|
178
|
+
prefix
|
|
179
|
+
);
|
|
180
|
+
}
|
|
181
|
+
function injectRuntimeEnvVars(envVars, processEnv) {
|
|
182
|
+
const items = {};
|
|
183
|
+
for (const key of Object.keys(envVars)) {
|
|
184
|
+
items[key] = processEnv[key] ?? envVars[key];
|
|
185
|
+
}
|
|
186
|
+
return items;
|
|
187
|
+
}
|
|
188
|
+
function runtimeEnvVarsToString(envVars) {
|
|
189
|
+
return Object.entries(envVars).map(([key, value]) => `${key}=${String(value)}`).join("\n");
|
|
190
|
+
}
|
|
191
|
+
function runtimeEnvValueToShellLiteral(value) {
|
|
192
|
+
const json = JSON.stringify(value) ?? "undefined";
|
|
193
|
+
return `'${json.replace(/'/g, "'\\''")}'`;
|
|
194
|
+
}
|
|
195
|
+
function runtimeEnvVarsToShellAssignments(envVars) {
|
|
196
|
+
return Object.entries(envVars).map(([key, value]) => `${key}=${runtimeEnvValueToShellLiteral(value)}`).join("\n");
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
// src/resolve.ts
|
|
200
|
+
function resolveRuntimeConfigValue(scopeConfig, scopeId, key, options = {}) {
|
|
201
|
+
const configKey = createRuntimeConfigKey(scopeId, key, options);
|
|
202
|
+
const contextOutputKey = options.contextOutputKey ?? "__contexts";
|
|
203
|
+
if (options.contextId) {
|
|
204
|
+
const contexts = scopeConfig?.[contextOutputKey];
|
|
205
|
+
const contextValue = contexts?.[options.contextId]?.[configKey];
|
|
206
|
+
if (contextValue !== void 0) {
|
|
207
|
+
return contextValue;
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
const globalValue = scopeConfig?.[configKey];
|
|
211
|
+
if (globalValue !== void 0) {
|
|
212
|
+
return globalValue;
|
|
213
|
+
}
|
|
214
|
+
return options.defaultValue;
|
|
215
|
+
}
|
|
216
|
+
function resolveRuntimeConfigValueFromRuntimeConfig(runtimeConfig, scopeId, key, options = {}) {
|
|
217
|
+
const { visibility = "public", ...resolveOptions } = options;
|
|
218
|
+
return resolveRuntimeConfigValue(runtimeConfig[visibility], scopeId, key, resolveOptions);
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
// src/scope.ts
|
|
222
|
+
function assignDefined2(target, key, value) {
|
|
223
|
+
if (value !== void 0) {
|
|
224
|
+
target[key] = value;
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
function collectRuntimeConfigScopeValues(input) {
|
|
228
|
+
const values = {};
|
|
229
|
+
for (const [configKey, value] of Object.entries(input.scopeConfig ?? {})) {
|
|
230
|
+
if (configKey.startsWith("__")) continue;
|
|
231
|
+
const key = stripRuntimeConfigScopePrefix(input.scopeId, configKey, input.options);
|
|
232
|
+
if (key) assignDefined2(values, key, value);
|
|
233
|
+
}
|
|
234
|
+
return values;
|
|
235
|
+
}
|
|
236
|
+
function getRuntimeConfigScope(runtimeConfig, scopeId, options = {}) {
|
|
237
|
+
const {
|
|
238
|
+
contextId,
|
|
239
|
+
contextOutputKey = "__contexts",
|
|
240
|
+
keys,
|
|
241
|
+
visibility = "public",
|
|
242
|
+
...keyOptions
|
|
243
|
+
} = options;
|
|
244
|
+
const scopeConfig = runtimeConfig[visibility];
|
|
245
|
+
if (keys) {
|
|
246
|
+
return Object.fromEntries(
|
|
247
|
+
keys.map((key) => {
|
|
248
|
+
const value = resolveRuntimeConfigValue(scopeConfig, scopeId, key, {
|
|
249
|
+
...keyOptions,
|
|
250
|
+
...contextId ? { contextId } : {},
|
|
251
|
+
contextOutputKey
|
|
252
|
+
});
|
|
253
|
+
return [key, value];
|
|
254
|
+
}).filter(([, value]) => value !== void 0)
|
|
255
|
+
);
|
|
256
|
+
}
|
|
257
|
+
const values = collectRuntimeConfigScopeValues({
|
|
258
|
+
scopeConfig,
|
|
259
|
+
scopeId,
|
|
260
|
+
options: keyOptions
|
|
261
|
+
});
|
|
262
|
+
if (!contextId) return values;
|
|
263
|
+
const contexts = scopeConfig?.[contextOutputKey];
|
|
264
|
+
const contextValues = collectRuntimeConfigScopeValues({
|
|
265
|
+
scopeConfig: contexts?.[contextId],
|
|
266
|
+
scopeId,
|
|
267
|
+
options: keyOptions
|
|
268
|
+
});
|
|
269
|
+
return {
|
|
270
|
+
...values,
|
|
271
|
+
...contextValues
|
|
272
|
+
};
|
|
273
|
+
}
|
|
274
|
+
function getPublicRuntimeConfigScope(runtimeConfig, scopeId, options = {}) {
|
|
275
|
+
return getRuntimeConfigScope(runtimeConfig, scopeId, {
|
|
276
|
+
...options,
|
|
277
|
+
visibility: "public"
|
|
278
|
+
});
|
|
279
|
+
}
|
|
280
|
+
function getPrivateRuntimeConfigScope(runtimeConfig, scopeId, options = {}) {
|
|
281
|
+
return getRuntimeConfigScope(runtimeConfig, scopeId, {
|
|
282
|
+
...options,
|
|
283
|
+
visibility: "private"
|
|
284
|
+
});
|
|
285
|
+
}
|
|
286
|
+
function getRuntimeConfigFragment(runtimeConfig, scopeId, options = {}) {
|
|
287
|
+
const { keys, ...scopeOptions } = options;
|
|
288
|
+
const publicOptions = keys?.public ? { ...scopeOptions, keys: keys.public } : scopeOptions;
|
|
289
|
+
const privateOptions = keys?.private ? { ...scopeOptions, keys: keys.private } : scopeOptions;
|
|
290
|
+
return {
|
|
291
|
+
public: getPublicRuntimeConfigScope(runtimeConfig, scopeId, publicOptions),
|
|
292
|
+
private: getPrivateRuntimeConfigScope(runtimeConfig, scopeId, privateOptions)
|
|
293
|
+
};
|
|
294
|
+
}
|
|
295
|
+
export {
|
|
296
|
+
createRuntimeConfigEnvKey,
|
|
297
|
+
createRuntimeConfigKey,
|
|
298
|
+
getPrivateRuntimeConfigScope,
|
|
299
|
+
getPublicRuntimeConfigScope,
|
|
300
|
+
getRuntimeConfigFragment,
|
|
301
|
+
getRuntimeConfigScope,
|
|
302
|
+
injectRuntimeEnvVars,
|
|
303
|
+
normalizeRuntimeConfigFragments,
|
|
304
|
+
projectRuntimeConfigEnvVars,
|
|
305
|
+
projectRuntimeConfigFragment,
|
|
306
|
+
projectRuntimeConfigNamespace,
|
|
307
|
+
projectRuntimeConfigNamespaces,
|
|
308
|
+
projectSectionedRuntimeConfig,
|
|
309
|
+
resolveRuntimeConfigValue,
|
|
310
|
+
resolveRuntimeConfigValueFromRuntimeConfig,
|
|
311
|
+
runtimeConfigVisibilities,
|
|
312
|
+
runtimeEnvValueToShellLiteral,
|
|
313
|
+
runtimeEnvVarsToShellAssignments,
|
|
314
|
+
runtimeEnvVarsToString,
|
|
315
|
+
stripRuntimeConfigScopePrefix,
|
|
316
|
+
toRuntimeConfigFragment,
|
|
317
|
+
toRuntimeEnvVars,
|
|
318
|
+
toSnakeUpperCase
|
|
319
|
+
};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import {
|
|
2
|
+
projectSectionedRuntimeConfig,
|
|
3
|
+
resolveRuntimeConfigValue,
|
|
4
|
+
} from '@lorion-org/runtime-config';
|
|
5
|
+
|
|
6
|
+
const runtimeConfig = projectSectionedRuntimeConfig(
|
|
7
|
+
[
|
|
8
|
+
{
|
|
9
|
+
scopeId: 'billing',
|
|
10
|
+
config: {
|
|
11
|
+
public: {
|
|
12
|
+
apiBase: '/api/billing',
|
|
13
|
+
},
|
|
14
|
+
tenants: {
|
|
15
|
+
tenantA: {
|
|
16
|
+
public: {
|
|
17
|
+
apiBase: '/tenant-a/billing',
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
],
|
|
24
|
+
{
|
|
25
|
+
contextInputKey: 'tenants',
|
|
26
|
+
contextOutputKey: '__tenants',
|
|
27
|
+
},
|
|
28
|
+
);
|
|
29
|
+
|
|
30
|
+
console.log(runtimeConfig.public);
|
|
31
|
+
// {
|
|
32
|
+
// billingApiBase: '/api/billing',
|
|
33
|
+
// __tenants: {
|
|
34
|
+
// tenantA: {
|
|
35
|
+
// billingApiBase: '/tenant-a/billing'
|
|
36
|
+
// }
|
|
37
|
+
// }
|
|
38
|
+
// }
|
|
39
|
+
|
|
40
|
+
console.log(
|
|
41
|
+
resolveRuntimeConfigValue(runtimeConfig.public, 'billing', 'apiBase', {
|
|
42
|
+
contextId: 'tenantA',
|
|
43
|
+
contextOutputKey: '__tenants',
|
|
44
|
+
}),
|
|
45
|
+
);
|
|
46
|
+
// '/tenant-a/billing'
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import {
|
|
2
|
+
runtimeEnvVarsToShellAssignments,
|
|
3
|
+
runtimeEnvVarsToString,
|
|
4
|
+
toRuntimeEnvVars,
|
|
5
|
+
} from '@lorion-org/runtime-config';
|
|
6
|
+
|
|
7
|
+
const envVars = toRuntimeEnvVars(
|
|
8
|
+
{
|
|
9
|
+
public: {
|
|
10
|
+
billingApiBase: '/api/billing',
|
|
11
|
+
},
|
|
12
|
+
private: {
|
|
13
|
+
billingApiSecret: 'secret',
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
'APP',
|
|
17
|
+
);
|
|
18
|
+
|
|
19
|
+
console.log(runtimeEnvVarsToString(envVars));
|
|
20
|
+
// APP_PUBLIC_BILLING_API_BASE=/api/billing
|
|
21
|
+
// APP_PRIVATE_BILLING_API_SECRET=secret
|
|
22
|
+
|
|
23
|
+
console.log(runtimeEnvVarsToShellAssignments(envVars));
|
|
24
|
+
// APP_PUBLIC_BILLING_API_BASE='"/api/billing"'
|
|
25
|
+
// APP_PRIVATE_BILLING_API_SECRET='"secret"'
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import {
|
|
2
|
+
projectRuntimeConfigNamespace,
|
|
3
|
+
projectRuntimeConfigNamespaces,
|
|
4
|
+
} from '@lorion-org/runtime-config';
|
|
5
|
+
|
|
6
|
+
const billingRuntimeConfig = projectRuntimeConfigNamespace('billing', {
|
|
7
|
+
public: {
|
|
8
|
+
apiBase: '/api/billing',
|
|
9
|
+
},
|
|
10
|
+
private: {
|
|
11
|
+
token: 'billing-token',
|
|
12
|
+
},
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
console.log(billingRuntimeConfig.public.billing);
|
|
16
|
+
// { apiBase: '/api/billing' }
|
|
17
|
+
|
|
18
|
+
console.log(billingRuntimeConfig.billing);
|
|
19
|
+
// { token: 'billing-token' }
|
|
20
|
+
|
|
21
|
+
const combinedRuntimeConfig = projectRuntimeConfigNamespaces([
|
|
22
|
+
{
|
|
23
|
+
scopeId: 'billing',
|
|
24
|
+
config: {
|
|
25
|
+
public: {
|
|
26
|
+
apiBase: '/api/billing',
|
|
27
|
+
},
|
|
28
|
+
private: {
|
|
29
|
+
token: 'billing-token',
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
scopeId: 'mail',
|
|
35
|
+
config: {
|
|
36
|
+
public: {
|
|
37
|
+
apiBase: '/api/mail',
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
]);
|
|
42
|
+
|
|
43
|
+
console.log(combinedRuntimeConfig.public.billing);
|
|
44
|
+
// { apiBase: '/api/billing' }
|
|
45
|
+
|
|
46
|
+
console.log(combinedRuntimeConfig.public.mail);
|
|
47
|
+
// { apiBase: '/api/mail' }
|
|
48
|
+
|
|
49
|
+
console.log(combinedRuntimeConfig.billing);
|
|
50
|
+
// { token: 'billing-token' }
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import {
|
|
2
|
+
getPrivateRuntimeConfigScope,
|
|
3
|
+
getPublicRuntimeConfigScope,
|
|
4
|
+
projectRuntimeConfigFragment,
|
|
5
|
+
toRuntimeEnvVars,
|
|
6
|
+
} from '@lorion-org/runtime-config';
|
|
7
|
+
|
|
8
|
+
const runtimeConfig = projectRuntimeConfigFragment('auth', {
|
|
9
|
+
public: {
|
|
10
|
+
url: 'https://auth.example.test',
|
|
11
|
+
realm: 'main',
|
|
12
|
+
},
|
|
13
|
+
private: {
|
|
14
|
+
clientSecret: 'secret',
|
|
15
|
+
},
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
console.log(runtimeConfig.public.authUrl);
|
|
19
|
+
// 'https://auth.example.test'
|
|
20
|
+
|
|
21
|
+
console.log(toRuntimeEnvVars(runtimeConfig, 'APP'));
|
|
22
|
+
// {
|
|
23
|
+
// APP_PUBLIC_AUTH_URL: 'https://auth.example.test',
|
|
24
|
+
// APP_PUBLIC_AUTH_REALM: 'main',
|
|
25
|
+
// APP_PRIVATE_AUTH_CLIENT_SECRET: 'secret'
|
|
26
|
+
// }
|
|
27
|
+
|
|
28
|
+
console.log(getPublicRuntimeConfigScope(runtimeConfig, 'auth'));
|
|
29
|
+
// { url: 'https://auth.example.test', realm: 'main' }
|
|
30
|
+
|
|
31
|
+
console.log(getPrivateRuntimeConfigScope(runtimeConfig, 'auth'));
|
|
32
|
+
// { clientSecret: 'secret' }
|