From 3927867c81e7c2dee1390ce2cbb654931ef5c064 Mon Sep 17 00:00:00 2001 From: Dhruwang Jariwala <67850763+Dhruwang@users.noreply.github.com> Date: Mon, 8 Jul 2024 13:46:41 +0530 Subject: [PATCH] chore: Remove NEXTAUTH_URL (#2840) --- .env.example | 4 ---- .github/workflows/kamal-deploy.yml | 1 - .github/workflows/kamal-setup.yml | 1 - apps/docs/app/developer-docs/integrations/slack/page.mdx | 2 +- apps/docs/app/self-hosting/configuration/page.mdx | 1 - apps/docs/app/self-hosting/migration-guide/page.mdx | 4 ---- apps/web/next.config.mjs | 1 + docker-compose.yml | 9 ++------- docker/docker-compose.yml | 4 ---- docker/formbricks.sh | 1 - kamal/deploy.yml | 1 - packages/lib/env.ts | 2 -- turbo.json | 1 - 13 files changed, 4 insertions(+), 28 deletions(-) diff --git a/.env.example b/.env.example index 2e40cfa9f7..b1eff8a6e6 100644 --- a/.env.example +++ b/.env.example @@ -31,10 +31,6 @@ DATABASE_URL='postgresql://postgres:postgres@localhost:5432/formbricks?schema=pu # You can use: `openssl rand -hex 32` to generate a secure one NEXTAUTH_SECRET=RANDOM_STRING -# Set this to your public-facing URL, e.g., https://example.com -# You do not need the NEXTAUTH_URL environment variable in Vercel. -NEXTAUTH_URL=http://localhost:3000 - # Cron Secret # You can use: `openssl rand -hex 32` to generate a secure one CRON_SECRET= diff --git a/.github/workflows/kamal-deploy.yml b/.github/workflows/kamal-deploy.yml index a60a1fd1d0..278602e2fc 100644 --- a/.github/workflows/kamal-deploy.yml +++ b/.github/workflows/kamal-deploy.yml @@ -18,7 +18,6 @@ jobs: IS_FORMBRICKS_CLOUD: ${{ vars.IS_FORMBRICKS_CLOUD }} WEBAPP_URL: ${{ vars.WEBAPP_URL }} MIGRATE_DATABASE_URL: ${{ secrets.MIGRATE_DATABASE_URL }} - NEXTAUTH_URL: ${{ vars.NEXTAUTH_URL }} DATABASE_URL: ${{ secrets.DATABASE_URL }} NEXTAUTH_SECRET: ${{ secrets.NEXTAUTH_SECRET }} ENCRYPTION_KEY: ${{ secrets.ENCRYPTION_KEY }} diff --git a/.github/workflows/kamal-setup.yml b/.github/workflows/kamal-setup.yml index 8c40f3a575..37a4aae6a2 100644 --- a/.github/workflows/kamal-setup.yml +++ b/.github/workflows/kamal-setup.yml @@ -14,7 +14,6 @@ jobs: DOCKER_BUILDKIT: 1 IS_FORMBRICKS_CLOUD: ${{ vars.IS_FORMBRICKS_CLOUD }} WEBAPP_URL: ${{ vars.WEBAPP_URL }} - NEXTAUTH_URL: ${{ vars.NEXTAUTH_URL }} DATABASE_URL: ${{ secrets.DATABASE_URL }} MIGRATE_DATABASE_URL: ${{ secrets.MIGRATE_DATABASE_URL }} NEXTAUTH_SECRET: ${{ secrets.NEXTAUTH_SECRET }} diff --git a/apps/docs/app/developer-docs/integrations/slack/page.mdx b/apps/docs/app/developer-docs/integrations/slack/page.mdx index 1539561102..f0124d6d8f 100644 --- a/apps/docs/app/developer-docs/integrations/slack/page.mdx +++ b/apps/docs/app/developer-docs/integrations/slack/page.mdx @@ -112,7 +112,7 @@ Enabling the Slack Integration in a self-hosted environment requires a setup usi "go": next dev --experimental-https -p 3000 ``` -- You also need to update the .env file in the `apps/web` directory to include the `NEXTAUTH_URL` and `WEBAPP_URL` as `https://localhost:3000` instead of `http://localhost:3000`. +- You also need to update the .env file in the `apps/web` directory to include the `WEBAPP_URL` as `https://localhost:3000` instead of `http://localhost:3000`. - You also need to run the terminal in admin mode to run the `go` script(to acquire the SSL certificate). You can do this by running the terminal as an administrator or using the `sudo` command in Unix-based systems. diff --git a/apps/docs/app/self-hosting/configuration/page.mdx b/apps/docs/app/self-hosting/configuration/page.mdx index 9a0b797c15..86934351f3 100644 --- a/apps/docs/app/self-hosting/configuration/page.mdx +++ b/apps/docs/app/self-hosting/configuration/page.mdx @@ -18,7 +18,6 @@ These variables are present inside your machine’s docker-compose file. Restart | DATABASE_URL | Database URL with credentials. | required | | | NEXTAUTH_SECRET | Secret for NextAuth, used for session signing and encryption. | required | (Generated by the user) | | ENCRYPTION_KEY | Secret for used by Formbricks for data encryption | required | (Generated by the user) | -| NEXTAUTH_URL | Location of the auth server. By default, this is the Formbricks docker instance itself. | required | http://localhost:3000 | | UPLOADS_DIR | Local directory for storing uploads. | optional | ./uploads | | S3_ACCESS_KEY | Access key for S3. | optional | (resolved by the AWS SDK) | | S3_SECRET_KEY | Secret key for S3. | optional | (resolved by the AWS SDK) | diff --git a/apps/docs/app/self-hosting/migration-guide/page.mdx b/apps/docs/app/self-hosting/migration-guide/page.mdx index 87d1b39346..e874872e52 100644 --- a/apps/docs/app/self-hosting/migration-guide/page.mdx +++ b/apps/docs/app/self-hosting/migration-guide/page.mdx @@ -685,10 +685,6 @@ x-environment: &environment # You can use: `openssl rand -hex 32` to generate one NEXTAUTH_SECRET: - # Set this to your public-facing URL, e.g., https://example.com - # You do not need the NEXTAUTH_URL environment variable in Vercel. - NEXTAUTH_URL: http://localhost:3000 - # PostgreSQL password POSTGRES_PASSWORD: postgres diff --git a/apps/web/next.config.mjs b/apps/web/next.config.mjs index 78c4b06d64..546546a288 100644 --- a/apps/web/next.config.mjs +++ b/apps/web/next.config.mjs @@ -153,6 +153,7 @@ const nextConfig = { env: { INSTANCE_ID: createId(), INTERNAL_SECRET: createId(), + NEXTAUTH_URL: process.env.WEBAPP_URL, }, }; diff --git a/docker-compose.yml b/docker-compose.yml index c7a2ab515c..c2023cb394 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -11,14 +11,10 @@ x-redis-url: &redis_url x-nextauth-secret: &nextauth_secret - # Set this to your public-facing URL, e.g., https://example.com - # You do not need the NEXTAUTH_URL environment variable in Vercel. + # Encryption key + # You can use: `openssl rand -hex 32` to generate one -x-nextauth-url: &nextauth_url http://localhost:3000 - -# Encryption key -# You can use: `openssl rand -hex 32` to generate one x-encryption-key: &encryption_key x-mail-from: &mail_from @@ -91,7 +87,6 @@ services: WEBAPP_URL: *webapp_url DATABASE_URL: *database_url NEXTAUTH_SECRET: *nextauth_secret - NEXTAUTH_URL: *nextauth_url MAIL_FROM: *mail_from SMTP_HOST: *smtp_host SMTP_PORT: *smtp_port diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index 068003f64b..e3142844ed 100644 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -15,10 +15,6 @@ x-environment: &environment # You can use: `openssl rand -hex 32` to generate one NEXTAUTH_SECRET: - # Set this to your public-facing URL, e.g., https://example.com - # You do not need the NEXTAUTH_URL environment variable in Vercel. - NEXTAUTH_URL: - # Encryption Key is used for 2FA & Single use URLs for Link Surveys # You can use: $(openssl rand -hex 32) to generate one ENCRYPTION_KEY: diff --git a/docker/formbricks.sh b/docker/formbricks.sh index 1e3e82b3a4..5a5ce341ee 100755 --- a/docker/formbricks.sh +++ b/docker/formbricks.sh @@ -143,7 +143,6 @@ EOT echo "🚙 Updating docker-compose.yml with your custom inputs..." sed -i "/WEBAPP_URL:/s|WEBAPP_URL:.*|WEBAPP_URL: \"https://$domain_name\"|" docker-compose.yml - sed -i "/NEXTAUTH_URL:/s|NEXTAUTH_URL:.*|NEXTAUTH_URL: \"https://$domain_name\"|" docker-compose.yml nextauth_secret=$(openssl rand -hex 32) && sed -i "/NEXTAUTH_SECRET:$/s/NEXTAUTH_SECRET:.*/NEXTAUTH_SECRET: $nextauth_secret/" docker-compose.yml echo "🚗 NEXTAUTH_SECRET updated successfully!" diff --git a/kamal/deploy.yml b/kamal/deploy.yml index 21d683ab85..d24f644190 100644 --- a/kamal/deploy.yml +++ b/kamal/deploy.yml @@ -37,7 +37,6 @@ env: secret: - IS_FORMBRICKS_CLOUD - WEBAPP_URL - - NEXTAUTH_URL - DATABASE_URL - MIGRATE_DATABASE_URL - NEXTAUTH_SECRET diff --git a/packages/lib/env.ts b/packages/lib/env.ts index 5fd343a04b..cd6e82fcf8 100644 --- a/packages/lib/env.ts +++ b/packages/lib/env.ts @@ -42,7 +42,6 @@ export const env = createEnv({ IS_FORMBRICKS_CLOUD: z.enum(["1", "0"]).optional(), MAIL_FROM: z.string().email().optional(), NEXTAUTH_SECRET: z.string().min(1), - NEXTAUTH_URL: z.string().url().optional(), NOTION_OAUTH_CLIENT_ID: z.string().optional(), NOTION_OAUTH_CLIENT_SECRET: z.string().optional(), OIDC_CLIENT_ID: z.string().optional(), @@ -143,7 +142,6 @@ export const env = createEnv({ IS_FORMBRICKS_CLOUD: process.env.IS_FORMBRICKS_CLOUD, MAIL_FROM: process.env.MAIL_FROM, NEXTAUTH_SECRET: process.env.NEXTAUTH_SECRET, - NEXTAUTH_URL: process.env.NEXTAUTH_URL, NEXT_PUBLIC_FORMBRICKS_API_HOST: process.env.NEXT_PUBLIC_FORMBRICKS_API_HOST, NEXT_PUBLIC_FORMBRICKS_ENVIRONMENT_ID: process.env.NEXT_PUBLIC_FORMBRICKS_ENVIRONMENT_ID, NEXT_PUBLIC_FORMBRICKS_ONBOARDING_SURVEY_ID: process.env.NEXT_PUBLIC_FORMBRICKS_ONBOARDING_SURVEY_ID, diff --git a/turbo.json b/turbo.json index ddad7579ee..f58a3af425 100644 --- a/turbo.json +++ b/turbo.json @@ -105,7 +105,6 @@ "OPENTELEMETRY_LISTENER_URL", "NEXT_RUNTIME", "NEXTAUTH_SECRET", - "NEXTAUTH_URL", "NODE_ENV", "OIDC_CLIENT_ID", "OIDC_CLIENT_SECRET",