Skip to content
Source
Sign inSign up
pingdotgg/t3code
Open History to see the last commit

Config.ts

38 lines1.4 KB

1import * as Context from "effect/Context";
2import * as Layer from "effect/Layer";
3import * as Redacted from "effect/Redacted";
4import * as Schema from "effect/Schema";
5​
6export const ApnsEnvironment = Schema.Literals(["sandbox", "production"]);
7export type ApnsEnvironment = typeof ApnsEnvironment.Type;
8​
9export interface ApnsCredentials {
10 readonly teamId: string;
11 readonly keyId: string;
12 readonly privateKey: Redacted.Redacted<string>;
13 readonly bundleId: string;
14 readonly environment: ApnsEnvironment;
16​
17export class RelayConfiguration extends Context.Service<
18 RelayConfiguration,
19 {
20 readonly relayIssuer: string;
21 readonly apns: ApnsCredentials | null;
22 readonly fcmServiceAccount?: Redacted.Redacted<string>;
23 readonly clerkSecretKey: Redacted.Redacted<string>;
24 readonly clerkPublishableKey: string;
25 readonly clerkJwtAudience: string;
26 readonly apnsDeliveryJobSigningSecret: Redacted.Redacted<string>;
27 readonly cloudMintPrivateKey: Redacted.Redacted<string>;
28 readonly cloudMintPublicKey: string;
29 readonly managedEndpointBaseDomain: string | undefined;
30 readonly managedEndpointNamespace: string | undefined;
31 }
32>()("t3code-relay/Config/RelayConfiguration") {}
33​
34export const make = (configuration: RelayConfiguration["Service"]) =>
35 RelayConfiguration.of(configuration);
36​
37export const layer = (configuration: RelayConfiguration["Service"]) =>
38 Layer.succeed(RelayConfiguration, make(configuration));