An open API service indexing awesome lists of open source software.

https://github.com/ausaf007/json-to-env

Simple bash script script to locally convert JSON files to .env format
https://github.com/ausaf007/json-to-env

bash cli environment-variables jq json

Last synced: over 1 year ago
JSON representation

Simple bash script script to locally convert JSON files to .env format

Awesome Lists containing this project

README

          

# json_to_env

`json_to_env` is a simple bash script utility to locally convert JSON files into `.env` format.

## Requirements

- `jq`: This script uses jq to parse and convert the JSON data.
- Flat JSON Structure: The provided JSON file should have a flat structure. Nested JSON structures are not supported for conversion.

## Usage

```bash
./json_to_env.sh
```

- ``: The path to your source JSON file.
- ``: The path where you want the resulting .env file to be saved.

### Example:

```bash
./json_to_env.sh config.json config.env
```

## Installation

1. Clone this repository or download the `json_to_env.sh` file directly.
2. Provide execute permissions to the script:

```bash
chmod +x json_to_env.sh
```

3. Ensure `jq` is installed. If not, you can generally install it using package managers:

For Ubuntu/Debian:
```bash
sudo apt-get install jq
```

For macOS (using Homebrew):
```bash
brew install jq
```

For other distributions or platforms, please check the `jq` [official documentation](https://stedolan.github.io/jq/download/).

## Contributing

Feel free to fork this repository, make changes, and submit pull requests. Any kind of contributions are welcome!

## License

[MIT](https://github.com/ausaf007/json-to-env/blob/master/LICENSE)