/** * One-time setup script: uploads the white Aynwerd logo to Cloudinary * as a plain (public) image asset, so it can be referenced as an * overlay layer when watermarking lesson videos (see * src/utils/cloudinaryUpload.js -> buildWatermarkTransformation). * * This is NOT a course asset — it's not sensitive and isn't uploaded * with `type: "authenticated"` — it just needs a stable public_id that * the video-overlay transformation can reference. * * Usage (run once, from server/): * node scripts/uploadWatermarkLogo.js * * Requires the same CLOUDINARY_* env vars as the rest of the app * (loaded via .env / your host's secrets, same as normal). * * If you ever want to swap the logo image, just re-run this script — * `overwrite: true` means it replaces the existing asset at the same * public_id, so no code changes are needed afterwards. */ require("dotenv").config(); const path = require("path"); const cloudinary = require("../src/config/cloudinary"); const LOGO_PATH = path.join(__dirname, "assets", "aynwerd-watermark-logo.png"); const PUBLIC_ID = process.env.CLOUDINARY_WATERMARK_LOGO_PUBLIC_ID || "aynwerd_watermark_logo"; async function main() { console.log(`Uploading ${LOGO_PATH} to Cloudinary as "${PUBLIC_ID}"...`); const result = await cloudinary.uploader.upload(LOGO_PATH, { public_id: PUBLIC_ID, resource_type: "image", type: "upload", // public delivery — this is just a logo, not course content overwrite: true, invalidate: true, }); console.log("Done. Watermark logo is live at public_id:", result.public_id); console.log( "If you set a custom CLOUDINARY_WATERMARK_LOGO_PUBLIC_ID, make sure it matches this value in your server env." ); } main() .then(() => process.exit(0)) .catch((err) => { console.error("Failed to upload watermark logo:", err.message); process.exit(1); });