All files / lib env-config.ts

100% Statements 6/6
100% Branches 2/2
100% Functions 4/4
100% Lines 6/6

Press n or j to go to the next uncovered block, b, p or k for the previous block.

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 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66                                  28x                     6x                                         23x 10x   13x                     13x    
/**
 * Non-Secret Environment Configuration
 *
 * Stores non-secret, environment-specific values in code rather than env vars.
 * Only true secrets (API keys, OAuth secrets, access tokens) belong in .dev.vars
 * or `wrangler secret put`.
 *
 * Follows the same pattern as domain-utils.ts: pure functions, env as parameter.
 */
 
import type { Environment } from "./domain-utils";
 
/**
 * WhatsApp Cloud API identifiers (non-secret, same across all environments).
 * These are Meta account IDs visible in the Meta Developer Console.
 */
export function getWhatsAppIds() {
	return {
		phoneNumberId: "952660017938765",
		wabaId: "18679790341626001867979034162600",
	} as const;
}
 
/**
 * OAuth provider public client IDs.
 * These are public values visible in OAuth redirect URLs — not secrets.
 */
export function getOAuthClientIds() {
	return {
		google:
			"330313688024-d12ad189cectr4d6mrbq7hb2hrrthj62.apps.googleusercontent.com",
		facebook: "953599880467479",
	} as const;
}
 
export type WhatsAppSafetyConfig = {
	overrideNumber: string | undefined;
	allowedNumbers: string[];
};
 
/**
 * WhatsApp safety guards for non-production environments.
 * In production, messages go to real recipients.
 * In non-prod, messages are redirected to the override number unless
 * the recipient is in the allowed list.
 */
export function getWhatsAppSafetyConfig(
	env: Environment,
): WhatsAppSafetyConfig {
	if (env === "production") {
		return { overrideNumber: undefined, allowedNumbers: [] };
	}
	return {
		overrideNumber: "919550794178",
		allowedNumbers: ["919550794178", "919885365664"],
	};
}
 
/**
 * SMS provider name for the given environment.
 * Currently only "console" is implemented.
 */
export function getSmsProviderName(_env: Environment): string {
	return "console";
}