Skip to content

Commit

Permalink
Merge pull request #71 from mia-ajuda/develop
Browse files Browse the repository at this point in the history
[HOTFIX] Corrige arquivo de configuração do firebase
  • Loading branch information
GabrielDVpereira authored Jul 24, 2020
2 parents 0813ba2 + ea5c93e commit 2fd0d9a
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 15 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -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/
Expand Down
5 changes: 2 additions & 3 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down
13 changes: 2 additions & 11 deletions src/config/authFirebase.js
Original file line number Diff line number Diff line change
@@ -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),
Expand Down

0 comments on commit 2fd0d9a

Please sign in to comment.