File size: 1,249 Bytes
1fe7075
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
export type Environment = 'development' | 'test' | 'staging' | 'production';

export interface AppConfig {
  environment: Environment;
  port: number;
  databaseUrl: string;
  allowedOrigins: string[];
  allowedOriginRegex: RegExp | null;
  clerk: {
    /** One per Clerk instance the API accepts, e.g. production and development. */
    secretKeys: string[];
    jwtKey?: string;
  };
  processingToken: {
    secret: string;
    ttlSeconds: number;
    audience: string;
    issuer: string;
  };
  internalTokenAudience: string;
  /** Lifetime free generations for accounts without a subscription. */
  freeGenerations: number;
  /** The Prevision site, for Stripe's success, cancel and portal return links. */
  appUrl: string;
  stripe: StripeConfig;
}

export type PlanId = 'starter' | 'growth';

export interface StripeConfig {
  secretKey: string;
  webhookSecret: string;
  /** Stripe Price id and monthly generation allowance of each plan. */
  plans: Record<PlanId, { priceId: string; monthlyGenerations: number }>;
  /** Public URL of the logo shown on Stripe Checkout. Optional. */
  logoUrl?: string;
  /** The branded billing portal configuration (bpc_...). Optional: Stripe's default otherwise. */
  portalConfigurationId?: string;
}