Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions complete-test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Paste the entire script above
12 changes: 6 additions & 6 deletions src/config/env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@
RATE_LIMIT_WINDOW_MS: number;
RATE_LIMIT_MAX_REQUESTS: number;
DISPUTE_NOTIFICATION_WEBHOOK_URL: string;
UPLOAD_STORAGE_DRIVER?: string; // Add this
AWS_S3_BUCKET?: string; // Add this
UPLOAD_STORAGE_DRIVER: string;
UPLOAD_LOCAL_DIR: string;
AWS_S3_BUCKET?: string;
}

const envSchema = z.object({
Expand All @@ -31,6 +32,9 @@
RATE_LIMIT_WINDOW_MS: z.coerce.number().int().min(1000).default(900000),
RATE_LIMIT_MAX_REQUESTS: z.coerce.number().int().min(1).default(100),
DISPUTE_NOTIFICATION_WEBHOOK_URL: z.string().default(''),
UPLOAD_STORAGE_DRIVER: z.string().default('local'),
UPLOAD_LOCAL_DIR: z.string().default('uploads'),
AWS_S3_BUCKET: z.string().optional(),
});

let env: EnvConfig;
Expand All @@ -39,22 +43,18 @@
env = envSchema.parse(process.env);
} catch (error) {
if (error instanceof z.ZodError) {
// eslint-disable-next-line no-console
console.error('❌ Invalid environment variables:');

Check warning on line 46 in src/config/env.ts

View workflow job for this annotation

GitHub Actions / build (22.x, 6.0)

Unexpected console statement
error.issues.forEach((issue) => {
// eslint-disable-next-line no-console
console.error(` - ${issue.path.join('.')}: ${issue.message}`);

Check warning on line 48 in src/config/env.ts

View workflow job for this annotation

GitHub Actions / build (22.x, 6.0)

Unexpected console statement
});
} else {
// eslint-disable-next-line no-console
console.error('❌ Failed to parse environment variables:', error);

Check warning on line 51 in src/config/env.ts

View workflow job for this annotation

GitHub Actions / build (22.x, 6.0)

Unexpected console statement
}
process.exit(1);
}

if (env.UPLOAD_STORAGE_DRIVER === 's3' && !env.AWS_S3_BUCKET) {
// eslint-disable-next-line no-console
console.error('❌ AWS_S3_BUCKET is required when UPLOAD_STORAGE_DRIVER=s3');

Check warning on line 57 in src/config/env.ts

View workflow job for this annotation

GitHub Actions / build (22.x, 6.0)

Unexpected console statement
process.exit(1);
}

Expand Down
Loading
Loading