# env_from_json

> This Node.js module exports a `config` function that can be used to create environment variables from a JSON object or file.

Latest version **0.0.1** (published 2023-08-16) · 0 weekly downloads

## Install

```sh
npm install env_from_json
pnpm add env_from_json
yarn add env_from_json
bun add env_from_json
```

## 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.0.1 |
| Published | 2023-08-16 |
| First published | 2023-08-16 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 5.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | lucianovilela@gmail.com |
| Maintainers | lucianovilela |
| Keywords | dotenv, env_from_json, json, env, .env, environment, variables, config, settings |

## Links

- npm: https://www.npmjs.com/package/env_from_json
- Repository: https://github.com/lucianovilela/env_from_json
- Homepage: https://github.com/lucianovilela/env_from_json#readme
- Issues: https://github.com/lucianovilela/env_from_json/issues
- npm.io page: https://npm.io/package/env_from_json

## 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.0.1 (latest) — 2023-08-16

## README

# env-from-json

This Node.js module exports a `config` function that can be used to create environment variables from a JSON object or file.

## Installation

To install this module, run the following command:

```
npm install env-from-json
```

## Usage

To use this module, first require it in your code:

```javascript
const { config } = require('env-from-json');
```

Then, call the `config` function with an object or a file path as the first argument:

```javascript
// create environment variables from an object
config({
    key1: 'value1',
    key2: {
        key3: 'value3',
        key4: ['value4', 'value5']
    }
});

// create environment variables from a file
config('./path/to/file.json');
```

The `config` function also takes an optional second argument that can be used to specify preferences:

```javascript
// create environment variables in lowercase and enable debug messages
config(undefined, { uppercase: false, debug: true });
```

The preferences object can have two properties: `uppercase` and `debug`. The `uppercase` property is a boolean that determines whether the keys of the resulting environment variables should be in uppercase or not. The default value is `true`. The `debug` property is a boolean that determines whether debug messages should be logged or not. The default value is `false`.

## License

This module is licensed under the MIT license.

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