nuxt-firebase-auth
nuxt-firebase-auth copied to clipboard
Extracting Firebase config into environment variables
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!
I'm with the same problem...
Problem still here in 2019
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.
The problem still persists in 2021, I really need the right way of doing it
Problem still here in 2022