38 lines
1.4 KiB
TypeScript
38 lines
1.4 KiB
TypeScript
import * as Context from "effect/Context";
|
|
import * as Layer from "effect/Layer";
|
|
import * as Redacted from "effect/Redacted";
|
|
import * as Schema from "effect/Schema";
|
|
|
|
export const ApnsEnvironment = Schema.Literals(["sandbox", "production"]);
|
|
export type ApnsEnvironment = typeof ApnsEnvironment.Type;
|
|
|
|
export interface ApnsCredentials {
|
|
readonly teamId: string;
|
|
readonly keyId: string;
|
|
readonly privateKey: Redacted.Redacted<string>;
|
|
readonly bundleId: string;
|
|
readonly environment: ApnsEnvironment;
|
|
}
|
|
|
|
export class RelayConfiguration extends Context.Service<
|
|
RelayConfiguration,
|
|
{
|
|
readonly relayIssuer: string;
|
|
readonly apns: ApnsCredentials;
|
|
readonly clerkSecretKey: Redacted.Redacted<string>;
|
|
readonly clerkPublishableKey: string;
|
|
readonly clerkJwtAudience: string;
|
|
readonly apnsDeliveryJobSigningSecret: Redacted.Redacted<string>;
|
|
readonly cloudMintPrivateKey: Redacted.Redacted<string>;
|
|
readonly cloudMintPublicKey: string;
|
|
readonly managedEndpointBaseDomain: string | undefined;
|
|
readonly managedEndpointNamespace: string | undefined;
|
|
}
|
|
>()("t3code-relay/Config/RelayConfiguration") {}
|
|
|
|
export const make = (configuration: RelayConfiguration["Service"]) =>
|
|
RelayConfiguration.of(configuration);
|
|
|
|
export const layer = (configuration: RelayConfiguration["Service"]) =>
|
|
Layer.succeed(RelayConfiguration, make(configuration));
|