Security News
The Risks of Misguided Research in Supply Chain Security
Snyk's use of malicious npm packages for research raises ethical concerns, highlighting risks in public deployment, data exfiltration, and unauthorized testing.
@firebase/remote-config-compat
Advanced tools
@firebase/remote-config-compat is a Firebase package that allows developers to manage and fetch remote configuration parameters for their applications. This package is part of the Firebase suite and provides compatibility with older versions of Firebase Remote Config, making it easier to integrate with existing projects.
Fetch and Activate Remote Config
This feature allows you to fetch and activate remote configuration parameters from the Firebase server. The code initializes Firebase, sets up Remote Config with default settings, and fetches the latest configuration values.
const firebase = require('firebase/app');
require('firebase/remote-config');
firebase.initializeApp({
apiKey: 'your-api-key',
authDomain: 'your-auth-domain',
projectId: 'your-project-id',
storageBucket: 'your-storage-bucket',
messagingSenderId: 'your-messaging-sender-id',
appId: 'your-app-id'
});
const remoteConfig = firebase.remoteConfig();
remoteConfig.settings = {
minimumFetchIntervalMillis: 3600000,
};
remoteConfig.defaultConfig = {
'welcome_message': 'Welcome to my app!'
};
remoteConfig.fetchAndActivate()
.then(() => {
const welcomeMessage = remoteConfig.getString('welcome_message');
console.log(welcomeMessage);
})
.catch((err) => {
console.error('Error fetching remote config:', err);
});
Get Remote Config Value
This feature allows you to retrieve a specific configuration value from the Remote Config. The code demonstrates how to get the value of 'welcome_message' after fetching and activating the remote configuration.
const firebase = require('firebase/app');
require('firebase/remote-config');
firebase.initializeApp({
apiKey: 'your-api-key',
authDomain: 'your-auth-domain',
projectId: 'your-project-id',
storageBucket: 'your-storage-bucket',
messagingSenderId: 'your-messaging-sender-id',
appId: 'your-app-id'
});
const remoteConfig = firebase.remoteConfig();
remoteConfig.settings = {
minimumFetchIntervalMillis: 3600000,
};
remoteConfig.defaultConfig = {
'welcome_message': 'Welcome to my app!'
};
remoteConfig.fetchAndActivate()
.then(() => {
const welcomeMessage = remoteConfig.getString('welcome_message');
console.log(welcomeMessage);
})
.catch((err) => {
console.error('Error fetching remote config:', err);
});
The 'config' package is a popular Node.js configuration management tool that allows you to manage configuration settings for your application. Unlike @firebase/remote-config-compat, which fetches configurations from Firebase servers, 'config' reads configurations from local files and environment variables.
The 'dotenv' package loads environment variables from a .env file into process.env. It is commonly used for managing configuration settings in Node.js applications. Unlike @firebase/remote-config-compat, 'dotenv' does not provide remote fetching capabilities and is limited to local environment variables.
The 'convict' package is a configuration management tool for Node.js applications that allows you to define a schema for your configuration files. It supports environment-based configurations and validation. Unlike @firebase/remote-config-compat, 'convict' does not offer remote fetching of configurations and is focused on local configuration management.
This is the compat package that recreates the v8 APIs.
This package is not intended for direct usage, and should only be used via the officially supported firebase package.
FAQs
The compatibility package of Remote Config
The npm package @firebase/remote-config-compat receives a total of 952,275 weekly downloads. As such, @firebase/remote-config-compat popularity was classified as popular.
We found that @firebase/remote-config-compat demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 4 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Snyk's use of malicious npm packages for research raises ethical concerns, highlighting risks in public deployment, data exfiltration, and unauthorized testing.
Research
Security News
Socket researchers found several malicious npm packages typosquatting Chalk and Chokidar, targeting Node.js developers with kill switches and data theft.
Security News
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.