feat: add Bunny Storage course cover uploads
This commit is contained in:
@@ -25,6 +25,11 @@ const environmentSchema = z.object({
|
||||
BUNNY_WEBHOOK_SECRET: optionalEnvironmentValue(z.string().min(20)),
|
||||
BUNNY_EMBED_TOKEN_TTL_SECONDS: z.coerce.number().int().min(60).max(86_400).default(600),
|
||||
BUNNY_MAX_UPLOAD_MB: z.coerce.number().int().min(1).max(5120).default(5120),
|
||||
BUNNY_STORAGE_ZONE: optionalEnvironmentValue(z.string().trim().min(1).max(120)),
|
||||
BUNNY_STORAGE_PASSWORD: optionalEnvironmentValue(z.string().min(1)),
|
||||
BUNNY_STORAGE_ENDPOINT: optionalEnvironmentValue(z.string().url()),
|
||||
BUNNY_STORAGE_CDN_HOST: optionalEnvironmentValue(z.string().url()),
|
||||
BUNNY_COVER_MAX_UPLOAD_MB: z.coerce.number().int().min(1).max(50).default(10),
|
||||
});
|
||||
|
||||
export const config = environmentSchema.parse(process.env);
|
||||
@@ -42,3 +47,14 @@ const bunnyConfigurationValues = [
|
||||
if (bunnyConfigurationValues.some(Boolean) && !bunnyConfigurationValues.every(Boolean)) {
|
||||
throw new Error('BUNNY_STREAM_LIBRARY_ID, BUNNY_STREAM_API_KEY, and BUNNY_EMBED_TOKEN_KEY must be configured together.');
|
||||
}
|
||||
|
||||
const bunnyStorageConfigurationValues = [
|
||||
config.BUNNY_STORAGE_ZONE,
|
||||
config.BUNNY_STORAGE_PASSWORD,
|
||||
config.BUNNY_STORAGE_ENDPOINT,
|
||||
config.BUNNY_STORAGE_CDN_HOST,
|
||||
];
|
||||
|
||||
if (bunnyStorageConfigurationValues.some(Boolean) && !bunnyStorageConfigurationValues.every(Boolean)) {
|
||||
throw new Error('BUNNY_STORAGE_ZONE, BUNNY_STORAGE_PASSWORD, BUNNY_STORAGE_ENDPOINT, and BUNNY_STORAGE_CDN_HOST must be configured together.');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user