const program = (key: string) =>
Effect.gen(function*() {
const remoteConfig = yield* Effect.tryPromise(() =>
admin.remoteConfig().getTemplate(),
);
const parameter = remoteConfig.parameters[key];
const {
defaultValue
} = parameter;
if (isUndefined(defaultValue) || !hasProperty(defaultValue, "value")) {
yield* Effect.fail(
new RemoteConfigError({
cause: `Remote config key '${key}' not found`,
}),
);
}
return defaultValue.value;
});
const program = (key: string) =>
Effect.gen(function*() {
const remoteConfig = yield* Effect.tryPromise(() =>
admin.remoteConfig().getTemplate(),
);
const parameter = remoteConfig.parameters[key];
const {
defaultValue
} = parameter;
if (isUndefined(defaultValue) || !hasProperty(defaultValue, "value")) {
yield* Effect.fail(
new RemoteConfigError({
cause: `Remote config key '${key}' not found`,
}),
);
}
return defaultValue.value;
});