From bf32ec765899d6158c05376d17aba4b32ac27187 Mon Sep 17 00:00:00 2001 From: Gabriel Davi Date: Fri, 24 Jul 2020 11:41:54 -0300 Subject: [PATCH 1/3] Fix firebase config file name --- .gitlab-ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 9b26a800..81d258f0 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -19,8 +19,8 @@ build: variables: IMAGE_NAME: "$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG" before_script: - - cat $FIREBASE_CONFIG_DEV > ./src/config/fibaseConfig-dev.js - - cat $FIREBASE_CONFIG > ./src/config/fibaseConfig.js + - cat $FIREBASE_CONFIG_DEV > ./src/config/firebaseConfig-dev.js + - cat $FIREBASE_CONFIG > ./src/config/firebaseConfig.js script: - echo "Building image" - docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY From ef17ed207f173787a6c8586c0b1a1097861dbe68 Mon Sep 17 00:00:00 2001 From: Welison Almeida Date: Fri, 24 Jul 2020 12:04:40 -0300 Subject: [PATCH 2/3] Unify firebase authentication files. --- .gitignore | 1 + .gitlab-ci.yml | 5 ++--- README.md | 2 +- src/config/authFirebase.js | 13 ++----------- 4 files changed, 6 insertions(+), 15 deletions(-) diff --git a/.gitignore b/.gitignore index c85afcaf..03a24d8d 100644 --- a/.gitignore +++ b/.gitignore @@ -44,6 +44,7 @@ jspm_packages/ # Firebase config src/config/firebaseConfig.js src/config/firebaseConfig-dev.js +src/config/firebaseAuthConfig.js # Snowpack dependency directory (https://snowpack.dev/) web_modules/ diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 81d258f0..02a8bf64 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -19,8 +19,7 @@ build: variables: IMAGE_NAME: "$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG" before_script: - - cat $FIREBASE_CONFIG_DEV > ./src/config/firebaseConfig-dev.js - - cat $FIREBASE_CONFIG > ./src/config/firebaseConfig.js + - cat $FIREBASE_CONFIG_DEV > ./src/config/firebaseAuthConfig.js script: - echo "Building image" - docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY @@ -40,7 +39,7 @@ build stable: variables: IMAGE_NAME: "$CI_REGISTRY_IMAGE:stable" before_script: - - cat $FIREBASE_CONFIG > ./src/config/fibaseConfig.js + - cat $FIREBASE_CONFIG_DEV > ./src/config/firebaseAuthConfig.js script: - echo "Building image" - docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY diff --git a/README.md b/README.md index 24e54438..5311b2c2 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ Inicialmente, instale localmente as seguintes dependências: ### Arquivos de Configuração -1. A aplicação utiliza-se de autenticação por meio do [firebase](https://firebase.google.com/), logo, insira na pasta `src/config` o arquivo `firebaseConfig-dev.js`. O arquivo de configuração obtido do firebase deve apresentar a seguinte fisionomia: +1. A aplicação utiliza-se de autenticação por meio do [firebase](https://firebase.google.com/), logo, insira na pasta `src/config` o arquivo do ambiente de desenvolvimento `firebaseAuthConfig.js`. O arquivo de configuração obtido do firebase deve apresentar a seguinte fisionomia: ```js const config = { diff --git a/src/config/authFirebase.js b/src/config/authFirebase.js index b41aa931..408c1d49 100644 --- a/src/config/authFirebase.js +++ b/src/config/authFirebase.js @@ -1,16 +1,7 @@ const admin = require('firebase-admin'); -const firebaseConfigDev = require('./firebaseConfig-dev'); -const firebaseConfigProd = require('./firebaseConfig'); +const firebaseAuthConfig = require('./firebaseAuthConfig'); -let firebaseConfig; -const enviroment = process.env.NODE_ENV; -if (enviroment === 'production') { - firebaseConfig = firebaseConfigProd; -} else { - firebaseConfig = firebaseConfigDev; -} - -const { databaseURL, config } = firebaseConfig; +const { databaseURL, config } = firebaseAuthConfig; admin.initializeApp({ credential: admin.credential.cert(config), From d62993187c4b28436c429aac93f174a6b6880f05 Mon Sep 17 00:00:00 2001 From: Welison Almeida Date: Fri, 24 Jul 2020 12:13:05 -0300 Subject: [PATCH 3/3] Fix variable name on CI pipeline. --- .gitlab-ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 02a8bf64..3f4d9d3b 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -19,7 +19,7 @@ build: variables: IMAGE_NAME: "$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG" before_script: - - cat $FIREBASE_CONFIG_DEV > ./src/config/firebaseAuthConfig.js + - cat $FIREBASE_CONFIG > ./src/config/firebaseAuthConfig.js script: - echo "Building image" - docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY @@ -39,7 +39,7 @@ build stable: variables: IMAGE_NAME: "$CI_REGISTRY_IMAGE:stable" before_script: - - cat $FIREBASE_CONFIG_DEV > ./src/config/firebaseAuthConfig.js + - cat $FIREBASE_CONFIG > ./src/config/firebaseAuthConfig.js script: - echo "Building image" - docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY