# simple-envvar-override-config

> Reads a config.json file and overrides values with environment variables

Latest version **0.1.0** (published 2020-08-01) · ISC license · 0 weekly downloads

## Install

```sh
npm install simple-envvar-override-config
pnpm add simple-envvar-override-config
yarn add simple-envvar-override-config
bun add simple-envvar-override-config
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.0 |
| Published | 2020-08-01 |
| First published | 2020-07-29 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 6.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | redsoxfantom |
| Maintainers | redsoxfantom |
| Keywords | config, json, environment, envvar |

## Links

- npm: https://www.npmjs.com/package/simple-envvar-override-config
- Repository: https://github.com/redsoxfantom/simple-envvar-override-config
- Homepage: https://github.com/redsoxfantom/simple-envvar-override-config#readme
- Issues: https://github.com/redsoxfantom/simple-envvar-override-config/issues
- npm.io page: https://npm.io/package/simple-envvar-override-config

## Alternatives

- [@mapbox/jsonlint-lines-primitives](https://npm.io/package/@mapbox/jsonlint-lines-primitives.md) — 5.3M weekly downloads
- [reftools](https://npm.io/package/reftools.md) — 3.5M weekly downloads
- [@hey-api/openapi-ts](https://npm.io/package/@hey-api/openapi-ts.md) — 3.5M weekly downloads
- [@mapbox/geojson-rewind](https://npm.io/package/@mapbox/geojson-rewind.md) — 2.4M weekly downloads
- [turbo-stream](https://npm.io/package/turbo-stream.md) — 1.7M weekly downloads

## Recent versions

- 0.1.0 (latest) — 2020-08-01
- 0.0.1 — 2020-07-29

## README

# simple-envvar-override-config

Allows you to read in a config file and selectively overwrite values based off of environment variables.

Config can be a file or just a dictionary

## Example
Given the following config file:
```json
{
    "name" : "nameval",
    "complex" : {
        "name" : "complexnameval",
        "num" : 100
    }
}
```
And the following environment variables:
```
ENVCONFIG_name = "newnameval"
ENVCONFIG_complex.num = "500"
ENVCONFIG_newvariable = "new variable value"
ENVCONFIG_newcomplex.newnum = "1000.5"
```
Then running the following code:
```javascript
const override_config = require('simple-envvar-override-config');
const new_config = override_config('/path/to/config.json');
console.log(new_config);
```
Will print the following:
```json
{
  "name": "newnameval",
  "complex": { 
      "name": "complexnameval", 
      "num": "500" 
  },
  "newvariable": "new variable value",
  "newcomplex": { 
      "newnum": "1000.5" 
  }
}
```

## TODOS
2) Handle arrays
3) Handle defining "type" of value in env var. Right now everything is a string

---
_Source: https://npm.io/package/simple-envvar-override-config · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
