Security News
38% of CISOs Fear They’re Not Moving Fast Enough on AI
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
@backstage/config-loader
Advanced tools
Config loading functionality used by Backstage backend, and CLI
@backstage/config-loader is a package designed to load and manage configuration files for Backstage applications. It supports various configuration formats and allows for merging and validating configurations, making it easier to manage complex setups.
Loading Configuration Files
This feature allows you to load configuration files from specified paths. The `loadConfig` function reads the configuration files and merges them into a single configuration object.
const { loadConfig } = require('@backstage/config-loader');
async function load() {
const config = await loadConfig({
configRoot: './config',
configPaths: ['./app-config.yaml'],
});
console.log(config.get());
}
load();
Merging Configurations
This feature allows you to merge multiple configuration files. The `loadConfig` function can take multiple paths, and it will merge the configurations in the order they are provided.
const { loadConfig } = require('@backstage/config-loader');
async function load() {
const config = await loadConfig({
configRoot: './config',
configPaths: ['./app-config.yaml', './app-config.local.yaml'],
});
console.log(config.get());
}
load();
Validating Configurations
This feature allows you to validate and read specific configuration values. The `ConfigReader` class provides methods to read and validate configuration values.
const { loadConfig } = require('@backstage/config-loader');
const { ConfigReader } = require('@backstage/config');
async function load() {
const config = await loadConfig({
configRoot: './config',
configPaths: ['./app-config.yaml'],
});
const configReader = new ConfigReader(config.get());
const value = configReader.getString('app.title');
console.log(value);
}
load();
The 'config' package is a popular Node.js configuration management solution. It allows for hierarchical configurations for different deployment environments. Compared to @backstage/config-loader, 'config' is more general-purpose and not specifically tailored for Backstage applications.
The 'dotenv' package loads environment variables from a .env file into process.env. While it is simpler and more focused on environment variables, it lacks the advanced merging and validation features of @backstage/config-loader.
The 'convict' package provides a way to define a schema for your configuration files, validate them, and load them. It offers similar validation capabilities as @backstage/config-loader but is more focused on schema definition and validation.
This package provides config loading functionality used by the backend, and CLI.
Do not install this package directly, it is an internal package used by @backstage/cli, and @backstage/backend-common. Depend on either of those instead.
FAQs
Config loading functionality used by Backstage backend, and CLI
The npm package @backstage/config-loader receives a total of 94,113 weekly downloads. As such, @backstage/config-loader popularity was classified as popular.
We found that @backstage/config-loader demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 3 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
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
Research
Security News
Socket researchers uncovered a backdoored typosquat of BoltDB in the Go ecosystem, exploiting Go Module Proxy caching to persist undetected for years.
Security News
Company News
Socket is joining TC54 to help develop standards for software supply chain security, contributing to the evolution of SBOMs, CycloneDX, and Package URL specifications.