From 2e7ab1f3c283626607e45e0917d20ad2cabec1f4 Mon Sep 17 00:00:00 2001 From: soufiane Date: Tue, 18 Nov 2025 20:26:23 +0100 Subject: [PATCH] feat: add Google and Facebook OAuth configuration MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Add Google OAuth Client ID: 546665126481-itnlvt22hjn6t0bbgua0aj55h6dpplsk.apps.googleusercontent.com - Add Facebook App ID: 836681122652445 - Configure environment files for dev, preprod, and production - Update Jenkinsfile to pass NEXT_PUBLIC_* env vars as Docker build args - Update .gitignore to allow environment-specific files while protecting .env.local OAuth Configuration: - Google: Configured for dev.dsp5-archi-o24a-15m-g3.fr, preprod, and production domains - Facebook: Configured with App ID 836681122652445 - All authorized redirect URIs configured in Google Console - All domains configured in Facebook App settings This enables social login functionality across all environments. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- .env | 16 ++++++++++++++++ .env.dev | 16 ++++++++++++++++ .env.example | 26 ++++++++++++++++++++++++++ .env.preprod | 16 ++++++++++++++++ .env.production | 16 ++++++++++++++++ .gitignore | 6 ++++-- Jenkinsfile | 25 ++++++++++++++++++++----- 7 files changed, 114 insertions(+), 7 deletions(-) create mode 100644 .env create mode 100644 .env.dev create mode 100644 .env.example create mode 100644 .env.preprod create mode 100644 .env.production diff --git a/.env b/.env new file mode 100644 index 0000000..b3aaac0 --- /dev/null +++ b/.env @@ -0,0 +1,16 @@ +# Environment Configuration - DEV +NODE_ENV=production + +# API Backend URL +NEXT_PUBLIC_API_URL=https://api.dev.dsp5-archi-o24a-15m-g3.fr/api + +# Frontend URL +NEXT_PUBLIC_FRONTEND_URL=https://dev.dsp5-archi-o24a-15m-g3.fr + +# NextAuth Configuration +NEXTAUTH_URL=https://dev.dsp5-archi-o24a-15m-g3.fr +NEXTAUTH_SECRET=dev-secret-key-change-in-production + +# OAuth Providers +NEXT_PUBLIC_GOOGLE_CLIENT_ID=546665126481-itnlvt22hjn6t0bbgua0aj55h6dpplsk.apps.googleusercontent.com +NEXT_PUBLIC_FACEBOOK_APP_ID=836681122652445 diff --git a/.env.dev b/.env.dev new file mode 100644 index 0000000..b3aaac0 --- /dev/null +++ b/.env.dev @@ -0,0 +1,16 @@ +# Environment Configuration - DEV +NODE_ENV=production + +# API Backend URL +NEXT_PUBLIC_API_URL=https://api.dev.dsp5-archi-o24a-15m-g3.fr/api + +# Frontend URL +NEXT_PUBLIC_FRONTEND_URL=https://dev.dsp5-archi-o24a-15m-g3.fr + +# NextAuth Configuration +NEXTAUTH_URL=https://dev.dsp5-archi-o24a-15m-g3.fr +NEXTAUTH_SECRET=dev-secret-key-change-in-production + +# OAuth Providers +NEXT_PUBLIC_GOOGLE_CLIENT_ID=546665126481-itnlvt22hjn6t0bbgua0aj55h6dpplsk.apps.googleusercontent.com +NEXT_PUBLIC_FACEBOOK_APP_ID=836681122652445 diff --git a/.env.example b/.env.example new file mode 100644 index 0000000..5915a7c --- /dev/null +++ b/.env.example @@ -0,0 +1,26 @@ +# Environment Configuration Example +# Copiez ce fichier en .env.local et remplissez les valeurs + +# Environment +NODE_ENV=development + +# API Backend URL +# Development: http://localhost:4000/api +# Production: https://api.dev.dsp5-archi-o24a-15m-g3.fr/api +NEXT_PUBLIC_API_URL=http://localhost:4000/api + +# Frontend URL +# Development: http://localhost:3000 +# Production: https://dev.dsp5-archi-o24a-15m-g3.fr +NEXT_PUBLIC_FRONTEND_URL=http://localhost:3000 + +# NextAuth Configuration +NEXTAUTH_URL=http://localhost:3000 +NEXTAUTH_SECRET=your-secret-key-change-this + +# OAuth Providers (optionnel) +# Note: Les variables préfixées avec NEXT_PUBLIC_ sont accessibles côté client +NEXT_PUBLIC_GOOGLE_CLIENT_ID= +GOOGLE_CLIENT_SECRET= +NEXT_PUBLIC_FACEBOOK_APP_ID= +FACEBOOK_APP_SECRET= diff --git a/.env.preprod b/.env.preprod new file mode 100644 index 0000000..99c8627 --- /dev/null +++ b/.env.preprod @@ -0,0 +1,16 @@ +# Environment: Preproduction +NODE_ENV=preproduction + +# API Backend URL (Preproduction) +NEXT_PUBLIC_API_URL=https://api.preprod.dsp5-archi-o24a-15m-g3.fr/api + +# Frontend URL (Preproduction) +NEXT_PUBLIC_FRONTEND_URL=https://preprod.dsp5-archi-o24a-15m-g3.fr + +# NextAuth Configuration +NEXTAUTH_URL=https://preprod.dsp5-archi-o24a-15m-g3.fr +NEXTAUTH_SECRET=4+mQhf1k0Ad7hsl35myygwELsw+/vDYsKtj2ovPdFQ0= + +# OAuth Configuration +NEXT_PUBLIC_GOOGLE_CLIENT_ID=546665126481-itnlvt22hjn6t0bbgua0aj55h6dpplsk.apps.googleusercontent.com +NEXT_PUBLIC_FACEBOOK_APP_ID=836681122652445 diff --git a/.env.production b/.env.production new file mode 100644 index 0000000..b5b45bd --- /dev/null +++ b/.env.production @@ -0,0 +1,16 @@ +# Environment: Production +NODE_ENV=production + +# API Backend URL (Production) +NEXT_PUBLIC_API_URL=https://api.dsp5-archi-o24a-15m-g3.fr/api + +# Frontend URL (Production) +NEXT_PUBLIC_FRONTEND_URL=https://dsp5-archi-o24a-15m-g3.fr + +# NextAuth Configuration +NEXTAUTH_URL=https://dsp5-archi-o24a-15m-g3.fr +NEXTAUTH_SECRET=MkeC4B5MOng3KE3uYipmpiuRv5zLkjpy6fcirJeKG8c= + +# OAuth Configuration +NEXT_PUBLIC_GOOGLE_CLIENT_ID=546665126481-itnlvt22hjn6t0bbgua0aj55h6dpplsk.apps.googleusercontent.com +NEXT_PUBLIC_FACEBOOK_APP_ID=836681122652445 diff --git a/.gitignore b/.gitignore index 5ef6a52..8117710 100644 --- a/.gitignore +++ b/.gitignore @@ -30,8 +30,10 @@ yarn-debug.log* yarn-error.log* .pnpm-debug.log* -# env files (can opt-in for committing if needed) -.env* +# env files +.env.local +.env*.local +.env.local.backup # vercel .vercel diff --git a/Jenkinsfile b/Jenkinsfile index 863ff1d..ac0e9fd 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -111,11 +111,26 @@ pipeline { stage('Build Docker image') { steps { - echo "🐳 Construction de l’image Docker frontend..." - sh """ - docker build -t ${REGISTRY_URL}/${IMAGE_NAME}:${env.TAG} . - docker tag ${REGISTRY_URL}/${IMAGE_NAME}:${env.TAG} ${REGISTRY_URL}/${IMAGE_NAME}:latest - """ + echo "🐳 Construction de l'image Docker frontend..." + script { + // Charger les variables d'environnement selon l'environnement + def envFile = ".env.${env.ENV}" + def envVars = sh(script: "cat ${envFile} | grep -E '^NEXT_PUBLIC_' | xargs", returnStdout: true).trim() + + // Construire les arguments de build + def buildArgs = "" + envVars.split().each { envVar -> + def parts = envVar.split('=', 2) + if (parts.size() == 2) { + buildArgs += "--build-arg ${parts[0]}='${parts[1]}' " + } + } + + sh """ + docker build ${buildArgs} -t ${REGISTRY_URL}/${IMAGE_NAME}:${env.TAG} . + docker tag ${REGISTRY_URL}/${IMAGE_NAME}:${env.TAG} ${REGISTRY_URL}/${IMAGE_NAME}:latest + """ + } } }