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

@geek/config

Package Overview
Dependencies
Maintainers
2
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@geek/config - npm Package Compare versions

Comparing version 0.1.0 to 0.1.1

1

bin/cli.js

@@ -18,3 +18,2 @@ #!/usr/bin/env node

// const prop1 = config.get('property1');
// console.error(`prop1: ${JSON.stringify(prop1, null, 2)}`);

10

index.js

@@ -60,3 +60,3 @@ 'use strict';

console.error(`options: ${JSON.stringify(options, null, 2)}`);
// console.error(`options: ${JSON.stringify(options, null, 2)}`);

@@ -107,3 +107,3 @@ // project user configs

console.error(`configFiles: ${JSON.stringify(configFiles, null, 2)}`);
// console.error(`configFiles: ${JSON.stringify(configFiles, null, 2)}`);

@@ -117,3 +117,3 @@ const finalConfig = {};

console.error(`finalConfig: ${JSON.stringify(finalConfig, null, 2)}`);
// console.error(`finalConfig: ${JSON.stringify(finalConfig, null, 2)}`);

@@ -147,5 +147,5 @@ this.store = finalConfig;

const filepath = path.join(options.cwd, `${options.filename}.${options.ext}`);
console.error(`filepath: ${JSON.stringify(filepath, null, 2)}`);
// console.error(`filepath: ${JSON.stringify(filepath, null, 2)}`);
if (! fs.pathExistsSync(filepath)) {
console.error('you are here → file not found');
// console.error('you are here → file not found');
return;

@@ -152,0 +152,0 @@ }

{
"name": "@geek/config",
"version": "0.1.0",
"version": "0.1.1",
"description": "Geek Configuration Manager for Node.js - The complete solution for managing config settings for your Node.js application",

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

@@ -16,6 +16,30 @@ # @geek/config

```bash
$ npm install @geek/config
npm install @geek/config
```
## Usage
```JavaScript
const Config = require('@geek/config');
// single profile
const config1 = new Config({
cwd: __dirname,
name: 'myapp',
profile: 'dev',
overrides: { property2: 'override-value' },
defaults: { property9: 'default-value' },
});
// multiple profiles
const config2 = new Config({
cwd: __dirname,
name: 'myapp',
profiles: [ 'dev', 'ios' ],
overrides: { property2: 'override-value' },
defaults: { property9: 'default-value' },
});
```
## Priority of config files

@@ -28,7 +52,7 @@

| 2. | **overrides** | `{ "property1": "override-value" }` | parameter: `overrides` |
| 3. | **user environment config file** | `myapp.dev.user.json` | *project directory* |
| 3. | **user profile config file** | `myapp.dev.user.json` | *project directory* |
| 4. | **user config file** | `myapp.user.json` | *project directory* |
| 5. | **project environment config file** | `myapp.dev.project.json` | *project directory* |
| 5. | **project profile config file** | `myapp.dev.project.json` | *project directory* |
| 6. | **project config file** | `myapp.project.json` | *project directory* |
| 7. | **global environment config fil**e | `myapp.dev.global.json` | *home config directory* |
| 7. | **global profile config fil**e | `myapp.dev.global.json` | *home config directory* |
| 8. | **global config file** | `myapp.global.json` | *home config directory* |

@@ -50,3 +74,3 @@ | 9. | **default values** | `{ "property1": "default-value" }` | parameter: `defaults` |

> if passed in environment only: `--environment dev`
> if passed in environment only: `--profile dev`

@@ -84,3 +108,3 @@ - process.env

> if passed in specific config file: `--config mytest.json --environment dev`
> if passed in specific config file: `--config mytest.json --profile dev`

@@ -87,0 +111,0 @@ - process.env

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