2024-04-18 21:55:54 +03:00
|
|
|
import 'reflect-metadata';
|
2024-05-14 14:31:09 +03:00
|
|
|
import 'server-only';
|
2024-04-18 21:55:54 +03:00
|
|
|
import { Type } from 'class-transformer';
|
2024-05-14 14:31:09 +03:00
|
|
|
import { IsString, ValidateNested, IsDefined, IsUrl } from 'class-validator';
|
2024-04-18 21:55:54 +03:00
|
|
|
import {
|
|
|
|
RootConfig as NestAppRootConfig,
|
|
|
|
validate,
|
|
|
|
} from '@fxa/payments/ui/server';
|
|
|
|
|
2024-05-14 14:31:09 +03:00
|
|
|
class CspConfig {
|
|
|
|
@IsUrl()
|
|
|
|
accountsStaticCdn!: string;
|
|
|
|
}
|
|
|
|
|
2024-04-18 21:55:54 +03:00
|
|
|
class AuthJSConfig {
|
2024-05-14 14:31:09 +03:00
|
|
|
@IsUrl({ require_tld: false })
|
2024-04-18 21:55:54 +03:00
|
|
|
issuerUrl!: string;
|
|
|
|
|
2024-05-14 14:31:09 +03:00
|
|
|
@IsUrl({ require_tld: false })
|
2024-04-18 21:55:54 +03:00
|
|
|
wellKnownUrl!: string;
|
|
|
|
|
|
|
|
@IsString()
|
|
|
|
clientId!: string;
|
|
|
|
}
|
|
|
|
|
|
|
|
export class PaymentsNextConfig extends NestAppRootConfig {
|
|
|
|
@Type(() => AuthJSConfig)
|
|
|
|
@ValidateNested()
|
|
|
|
@IsDefined()
|
|
|
|
auth!: AuthJSConfig;
|
|
|
|
|
2024-05-14 14:31:09 +03:00
|
|
|
@Type(() => CspConfig)
|
|
|
|
@ValidateNested()
|
|
|
|
@IsDefined()
|
|
|
|
csp!: CspConfig;
|
|
|
|
|
2024-04-18 21:55:54 +03:00
|
|
|
@IsString()
|
|
|
|
authSecret!: string;
|
2024-05-14 14:31:09 +03:00
|
|
|
|
|
|
|
@IsString()
|
|
|
|
stripePublicApiKey!: string;
|
|
|
|
|
|
|
|
@IsUrl({ require_tld: false })
|
|
|
|
contentServerUrl!: string;
|
2024-04-18 21:55:54 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
export const config = validate(process.env, PaymentsNextConfig);
|