Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

standard-settings

Package Overview
Dependencies
Maintainers
3
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

standard-settings - npm Package Compare versions

Comparing version 1.1.7 to 1.1.8

25

index.js

@@ -32,15 +32,22 @@ // first settings loaded are stronger than last one

let lookUpPath = '.'
if (fs.existsSync(path.resolve(process.cwd(), secondarySettingsPath))) {
lookUpPath = process.cwd()
} else if (fs.existsSync(path.resolve(path.dirname(require.main.filename), secondarySettingsPath))) {
lookUpPath = path.dirname(require.main.filename)
let settingsPath = '.'
let lookUpPaths = [
process.cwd(),
require.main.filename,
path.resolve(path.dirname(require.main.filename), '../../../'), // inside electron
path.resolve(path.dirname(require.main.filename), '../../../app.asar.unpacked/') // inside electron with asar
]
for (let lookUpPath in lookUpPaths) {
if (fs.existsSync(path.resolve(lookUpPaths[lookUpPath], secondarySettingsPath))) {
settingsPath = lookUpPaths[lookUpPath]
break
}
}
if (!fs.existsSync(path.resolve(lookUpPath, secondarySettingsPath))) {
console.warn('Cannot find ' + path.resolve(lookUpPath, secondarySettingsPath))
if (!fs.existsSync(path.resolve(settingsPath, secondarySettingsPath))) {
console.warn('Settings not found ' + secondarySettingsPath)
}
nconf.file({file: path.resolve(lookUpPath, primarySettingsPath)})
.file('default', path.resolve(lookUpPath, secondarySettingsPath))
nconf.file({file: path.resolve(settingsPath, primarySettingsPath)})
.file('default', path.resolve(settingsPath, secondarySettingsPath))

@@ -47,0 +54,0 @@ var getMeta = media => {

{
"name": "standard-settings",
"version": "1.1.7",
"version": "1.1.8",
"description": "Standardised settings loader",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -11,3 +11,11 @@ # standard-settings

## Why
No more `cp config.sample.json config.json`
Your app presents a `settings/settings.default.json` which is always included.
User or other developer needing custom settings loads his custom settings which overrides the default settings.
If a key is missing in user settings, it won't trigger errors, as a default value is in `settings.default.json`
`standard-settings` offers multiple ways to change settings: `settings.json` file, command line arguments, environment variables. Check below examples for usage and priority order.
## Usage

@@ -14,0 +22,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc