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 9b26a800..3f4d9d3b 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/fibaseConfig-dev.js - - cat $FIREBASE_CONFIG > ./src/config/fibaseConfig.js + - cat $FIREBASE_CONFIG > ./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 > ./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),