diff --git a/.env.example b/.env.example index a342afa4e8..d994f929b7 100644 --- a/.env.example +++ b/.env.example @@ -8,6 +8,9 @@ WEBAPP_URL=http://localhost:3000 +# Required for next-auth. Should be the same as WEBAPP_URL +NEXTAUTH_URL=http://localhost:3000 + # Set this if you want to have a shorter link for surveys SHORT_URL_BASE= diff --git a/apps/docs/app/self-hosting/configuration/page.mdx b/apps/docs/app/self-hosting/configuration/page.mdx index fc490837b5..436632b4d9 100644 --- a/apps/docs/app/self-hosting/configuration/page.mdx +++ b/apps/docs/app/self-hosting/configuration/page.mdx @@ -15,6 +15,7 @@ These variables are present inside your machine’s docker-compose file. Restart | Variable | Description | Required | Default | | ---------------------------- | -------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------- | ------------------------- | | WEBAPP_URL | Base URL of the site. | required | http://localhost:3000 | +| NEXTAUTH_URL | Location of the auth server. This should normally be the same as WEBAPP_URL | required | http://localhost:3000 | | 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) | diff --git a/apps/docs/app/self-hosting/migration-guide/page.mdx b/apps/docs/app/self-hosting/migration-guide/page.mdx index e874872e52..cb160a69d2 100644 --- a/apps/docs/app/self-hosting/migration-guide/page.mdx +++ b/apps/docs/app/self-hosting/migration-guide/page.mdx @@ -677,6 +677,9 @@ x-environment: &environment # The url of your Formbricks instance used in the admin panel WEBAPP_URL: + # Required for next-auth. Should be the same as WEBAPP_URL + NEXTAUTH_URL: + # PostgreSQL DB for Formbricks to connect to DATABASE_URL: "postgresql://postgres:postgres@postgres:5432/formbricks?schema=public" diff --git a/docker-compose.yml b/docker-compose.yml index bed17c85a4..05455ae96f 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,6 +1,8 @@ # This should be the same as below if you are running via docker compose up x-webapp-url: &webapp_url http://localhost:3000 +x-nextauth-url: &nextauth_url http://localhost:3000 + # PostgreSQL DB for Formbricks to connect to x-database-url: &database_url postgresql://postgres:postgres@postgres:5432/formbricks?schema=public diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index f20b2bffe9..a86776318a 100644 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -7,6 +7,9 @@ x-environment: &environment # Set this to your public-facing URL, e.g., https://example.com WEBAPP_URL: + # Required for next-auth. Should be the same as WEBAPP_URL + NEXTAUTH_URL: + # PostgreSQL DB for Formbricks to connect to DATABASE_URL: "postgresql://postgres:postgres@postgres:5432/formbricks?schema=public" diff --git a/docker/formbricks.sh b/docker/formbricks.sh index 898e7613f1..b78766b177 100755 --- a/docker/formbricks.sh +++ b/docker/formbricks.sh @@ -143,6 +143,7 @@ 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/turbo.json b/turbo.json index 84ae4c197b..428191998b 100644 --- a/turbo.json +++ b/turbo.json @@ -105,6 +105,7 @@ "OPENTELEMETRY_LISTENER_URL", "NEXT_RUNTIME", "NEXTAUTH_SECRET", + "NEXTAUTH_URL", "NODE_ENV", "OIDC_CLIENT_ID", "OIDC_CLIENT_SECRET",