Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extracting Firebase config into environment variables #2

Open
CanyonTurtle opened this issue Dec 4, 2017 · 5 comments
Open

Extracting Firebase config into environment variables #2

CanyonTurtle opened this issue Dec 4, 2017 · 5 comments

Comments

@CanyonTurtle
Copy link

I am very fond of this project by the way.

Is there a specific reason that services/fireinit.js doesn't use the .env variables? It seems like the firebase config object could use process.env.API_KEY and so forth as values instead of the copied string literals that will be the same as in the .env file already.

It would look something like this:

// services/fireinit.js

var config = {
  apiKey: process.env.API_KEY,
  authDomain: process.env.AUTH_DOMAIN,
  databaseURL: process.env.DB_URL,
  projectId: process.env.PROJECT_ID,
  storageBucket: process.env.STORAGE_BUCKET,
  messagingSenderId: process.env.MESSAGING_SENDER_ID
}

I used @nuxtjs/dotenv to facilitate using .env for this on a side project. I'm not sure what happens on the Firebase console side as far as configuring environment variables, but I was able to get a working project deployed on Firebase hosting myself without any extra effort besides setting up the aforementioned. I know Netlify, a similar service to Firebase hosting, offers environment variable configuration and I am sure there must be a similar solution for Firebase and other hosting services.

I could make a PR if you are interested!

Again, awesome project!

@DaviRolim
Copy link

I'm with the same problem...

@rorp24
Copy link

rorp24 commented Sep 5, 2019

Problem still here in 2019

@paulvonber
Copy link

Problem still here in 2020, simply nuxt is just a mess in terms of security, it exposes everything what's possible and there is no proper explanation how to get rid of this problem.

@Abel-Moremi
Copy link

Abel-Moremi commented Aug 4, 2021

The problem still persists in 2021, I really need the right way of doing it

@yarliganfatih
Copy link

Problem still here in 2022

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants