“Firebase Env” Respostas de código

Firebase Env

On .env.local file you have to write
//All "" will have to remove
REACT_APP_FIREBASE_API_KEY=
REACT_APP_FIREBASE_AUTH_DOMAIN=
REACT_APP_FIREBASE_PROJECT_ID=
REACT_APP_FIREBASE_STORAGE_BUCKET=
REACT_APP_FIREBASE_MESSAGING_SENDER_ID=
REACT_APP_FIREBASE_APP_ID=
Zany Zebra

Firebase Env

const firebaseConfig = {
    apiKey: process.env.REACT_APP_FIREBASE_API_KEY,
    authDomain: process.env.REACT_APP_FIREBASE_AUTH_DOMAIN,
    projectId: process.env.REACT_APP_FIREBASE_PROJECT_ID,
    storageBucket: process.env.REACT_APP_FIREBASE_STORAGE_BUCKET,
    messagingSenderId: process.env.REACT_APP_FIREBASE_MESSAGING_SENDER_ID,
    appId: process.env.REACT_APP_FIREBASE_APP_ID,
  };
  
  Then import it otherwise it will not work
Zany Zebra

Variáveis ​​de ambiente do Firebase

$ cd project_directory
$ cd functions
$ firebase functions:config:set api_key1="YOUR_API_KEY1" api_key2="YOUR_API_KEY2"

// Accessing the Keys in Code

const functions = require('firebase-functions');

const api_key1  = functions.config().api_key1;
const api_key2  = functions.config().api_key2;
Inquisitive Iguana

Respostas semelhantes a “Firebase Env”

Perguntas semelhantes a “Firebase Env”

Procure respostas de código populares por idioma

Procurar outros idiomas de código