From f37f98aadea4d8cc3e7490e0aec6c546caa72be4 Mon Sep 17 00:00:00 2001 From: Ephraim Atta-Duncan Date: Sun, 30 Jun 2024 00:33:49 +0000 Subject: [PATCH] fix: avoid using defined secrets in calcom template --- templates/calcom/docker-compose.yml | 4 ++-- templates/calcom/index.ts | 6 ++++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/templates/calcom/docker-compose.yml b/templates/calcom/docker-compose.yml index cd77521c..73439fbe 100644 --- a/templates/calcom/docker-compose.yml +++ b/templates/calcom/docker-compose.yml @@ -17,8 +17,8 @@ services: depends_on: - postgres environment: - - NEXTAUTH_SECRET=asklmdaklsmdklasmdklasd - - CALENDSO_ENCRYPTION_KEY=asklmdaklsmdklasmdklasd + - NEXTAUTH_SECRET=${NEXTAUTH_SECRET} + - CALENDSO_ENCRYPTION_KEY=${CALENDSO_ENCRYPTION_KEY} - DATABASE_URL=postgres://postgres:password@postgres:5432/db - NEXT_PUBLIC_WEBAPP_URL=http://${CALCOM_HOST} - NEXTAUTH_URL=http://${CALCOM_HOST}/api/auth diff --git a/templates/calcom/index.ts b/templates/calcom/index.ts index 34439432..5dffd20c 100644 --- a/templates/calcom/index.ts +++ b/templates/calcom/index.ts @@ -3,16 +3,22 @@ import { generateRandomDomain, type Template, type Schema, + generateBase64, } from "../utils"; // https://cal.com/ export function generate(schema: Schema): Template { const mainServiceHash = generateHash(schema.projectName); const randomDomain = generateRandomDomain(schema); + const calcomEncryptionKey = generateBase64(32); + const nextAuthSecret = generateBase64(32); + const envs = [ `CALCOM_HOST=${randomDomain}`, "CALCOM_PORT=3000", `HASH=${mainServiceHash}`, + `NEXTAUTH_SECRET=${nextAuthSecret}`, + `CALCOM_ENCRYPTION_KEY=${calcomEncryptionKey}`, ]; return {