Socket
Book a DemoInstallSign in
Socket

@restorecommerce/service-config

Package Overview
Dependencies
Maintainers
5
Versions
53
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@restorecommerce/service-config

An opinionated wrapper of nconf optimized for microservices

latest
Source
npmnpm
Version
1.1.3
Version published
Maintainers
5
Created
Source

@restorecommerce/service-config

An opinionated wrapper of nconf.

Configuration settings are obtain from the following sources in the given order:

  • Command argument
  • Environment variables
  • Configuration files

1.) and 2.) support passing nested object properties with the following pattern:

# Original Configuration JSON file
{
  "someObject": {
    "paramA": "A"
  }
}

Can be overridden via env var or command line parameter someObject__paramA. So the nesting is designated by a double underscore.

3.) tries to load the following configuration files from the cfg folder:

  • Default configuration file config.json
  • Additional sub-variants added to the value of the environment variable NODE_ENV for example a value development:development would try to load config_development.json

Usage

import { createServiceConfig } from '@restorecommerce/service-config';

...

const cfg = createServiceConfig('./test', { stageVar: 'NODE_ENV', logger: logger});
const testSetting = cfg.get('test');

Keywords

restore

FAQs

Package last updated on 12 Jun 2025

Did you know?

Socket

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.

Install

Related posts