Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Integrate remote config with Nodejs [closed]

I'm looking for a better way to integrate firebase remote config into my Nodejs server.

Basically I have 2 questions,

  1. 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?

  2. 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.

like image 210
mahendra Avatar asked Aug 11 '26 21:08

mahendra


1 Answers

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

like image 150
0xori Avatar answered Aug 14 '26 13:08

0xori



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!