env
All checks were successful
Build & Deploy KLZ Cables / build-and-deploy (push) Successful in 3m53s
All checks were successful
Build & Deploy KLZ Cables / build-and-deploy (push) Successful in 3m53s
This commit is contained in:
@@ -13,6 +13,9 @@ export async function register() {
|
||||
|
||||
// Initialize server services on boot
|
||||
// We do this AFTER Sentry to ensure errors during service init are caught
|
||||
const { validateConfig } = await import('@/lib/config');
|
||||
validateConfig();
|
||||
|
||||
const { getServerAppServices } = await import('@/lib/services/create-services.server');
|
||||
getServerAppServices();
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ const getEnv = (key: string, defaultValue?: string): string | undefined => {
|
||||
(trimmed.startsWith('"') && trimmed.endsWith('"'))) {
|
||||
return trimmed.slice(1, -1);
|
||||
}
|
||||
if (trimmed !== '') return trimmed;
|
||||
return trimmed;
|
||||
}
|
||||
|
||||
return defaultValue;
|
||||
@@ -141,8 +141,12 @@ export function validateConfig() {
|
||||
];
|
||||
|
||||
for (const key of required) {
|
||||
if (!getEnv(key)) {
|
||||
throw new Error(`Missing required environment variable: ${key}`);
|
||||
const value = getEnv(key);
|
||||
if (!value) {
|
||||
// In Next.js, process.env might not be a real object with enumerable keys in the bundle
|
||||
// so we check the specific key directly
|
||||
const rawValue = process.env[key];
|
||||
throw new Error(`Missing required environment variable: ${key}. (getEnv: "${value}", process.env: "${rawValue}"). If this is set in your environment, ensure it is not being shadowed or cleared by the container runtime.`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,9 +7,6 @@ import { GlitchtipErrorReportingService } from './errors/glitchtip-error-reporti
|
||||
import { NoopErrorReportingService } from './errors/noop-error-reporting-service';
|
||||
import { PinoLoggerService } from './logging/pino-logger-service';
|
||||
import { config, getMaskedConfig, validateConfig } from '../config';
|
||||
// Validate configuration on server startup
|
||||
validateConfig();
|
||||
|
||||
let singleton: AppServices | undefined;
|
||||
|
||||
export function getServerAppServices(): AppServices {
|
||||
|
||||
Reference in New Issue
Block a user