resolved conflicts

Signed-off-by: Matto <muhamadto@gmail.com>
This commit is contained in:
Matto
2021-10-29 14:56:31 +11:00
parent 1cecd737f9
commit 5b51907cbf
2 changed files with 20 additions and 25 deletions
+16
View File
@@ -84,51 +84,66 @@ export class ObservableConfigProxy implements Config {
has(key: string): boolean {
return this.select(false)?.has(key) ?? false;
}
keys(): string[] {
return this.select(false)?.keys() ?? [];
}
get<T = JsonValue>(key?: string): T {
return this.select(true).get(key);
}
getOptional<T = JsonValue>(key?: string): T | undefined {
return this.select(false)?.getOptional(key);
}
getConfig(key: string): Config {
return new ObservableConfigProxy(this.logger, this, key);
}
getOptionalConfig(key: string): Config | undefined {
if (this.select(false)?.has(key)) {
return new ObservableConfigProxy(this.logger, this, key);
}
return undefined;
}
getConfigArray(key: string): Config[] {
return this.select(true).getConfigArray(key);
}
getOptionalConfigArray(key: string): Config[] | undefined {
return this.select(false)?.getOptionalConfigArray(key);
}
getNumber(key: string): number {
return this.select(true).getNumber(key);
}
getOptionalNumber(key: string): number | undefined {
return this.select(false)?.getOptionalNumber(key);
}
getBoolean(key: string): boolean {
return this.select(true).getBoolean(key);
}
getOptionalBoolean(key: string): boolean | undefined {
return this.select(false)?.getOptionalBoolean(key);
}
getString(key: string): string {
return this.select(true).getString(key);
}
getOptionalString(key: string): string | undefined {
return this.select(false)?.getOptionalString(key);
}
getStringArray(key: string): string[] {
return this.select(true).getStringArray(key);
}
getOptionalStringArray(key: string): string[] | undefined {
return this.select(false)?.getOptionalStringArray(key);
}
@@ -184,6 +199,7 @@ export async function loadBackendConfig(options: {
}
}),
},
remote: { reloadIntervalSeconds: 10 },
});
options.logger.info(
+4 -25
View File
@@ -24,7 +24,6 @@ import {
applyConfigTransforms,
createIncludeTransform,
createSubstitutionTransform,
EnvFunc,
isValidUrl,
readEnvConfig,
} from './lib';
@@ -51,29 +50,6 @@ export type LoadConfigOptionsRemote = {
reloadIntervalSeconds: number;
};
/** @public */
export type RemoteConfigProp = {
/**
* URL of the remote config
*/
url: string;
/**
* Contents of the remote config
*/
content: string | null;
/**
* An optional new ETag header value. Used when checking for updated config.
*/
newETag?: string;
/**
* An optional old ETag header value. Used when checking for updated config
*/
oldETag?: string;
};
/**
* Options that control the loading of configuration files in the backend.
*
@@ -229,7 +205,10 @@ export async function loadConfig(
try {
remoteConfigs = await loadRemoteConfigFiles();
} catch (error) {
throw new ForwardedError(`Failed to read remote configuration file, ${error}`);
throw new ForwardedError(
`Failed to read remote configuration file`,
error,
);
}
}