Firebase Remote Config library
This library used for interaction with
Firebase Remote Config
REST API to set or get
Remote Config values in node.js environment.
Dependencies
The library uses google-auth-library npm package
and provides a variety of ways to authenticate Remote Config API requests:
- Provide a keyId and key of your Firebase project.
- Provide a private key file for your Firebase service account.
- Provide GOOGLE_APPLICATION_CREDENTIALS environment variable.
- Use none of above in case of usage of the library on Google Cloud.
Read about Google Cloud API authentication at
Getting Started with Authentication
The library uses node-cache npm package for storing ETag value.
See cacheOptions config option.
The library uses flat npm package for flatten and unflatten Remote Config parameters.
See delimiter config option.
Example
import * as path from 'path';
import {
FirebaseConfig,
DataObject,
} from '@inpassor/firebase-config';
const firebaseConfig = new FirebaseConfig({
projectId: 'my-awesome-project-id',
keyFileName: path.resolve('path', 'to', 'my-awesome-project-service-key.json'),
});
firebaseConfig.set({
}).then(
() => console.log('published'),
(error: any) => console.error(error),
);
firebaseConfig.get().then(
(parameters: DataObject) => console.log(parameters),
(error: any) => console.error(error),
);