I'm looking for a better way to integrate firebase remote config into my Nodejs server.
Basically I have 2 questions,
firebase's Official js sdk documentation says remoteconfig does not support nodeJs, I was wondering what's the reason behind supporting web and not nodeJS?
nodejs-quickstart uses rest endpoint, if I use this technique for managing my server's config,would I have to Implement polling? or is there a better way?
PS : Env variables are not an option because these configs changed over the time.
You can use admin SDK
const admin = require("firebase-admin");
const serviceAccount = require("path/toyour/firebase-adminsdk.json");
admin.initializeApp({
credential: admin.credential.cert(serviceAccount),
databaseURL: "https://<project-database>.firebaseio.com"
});
const getConfig = async () => {
let config = admin.remoteConfig();
const template = await config.getTemplate()
//all parameters will be under template.parameters
}
see docs here
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With