Ecosyste.ms: Awesome

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

Awesome Lists | Featured Topics | Projects

https://github.com/wickes1/envex

Dotenv sample made easy!
https://github.com/wickes1/envex

cli dotenv golang

Last synced: 7 days ago
JSON representation

Dotenv sample made easy!

Awesome Lists containing this project

README

        

# Envex

Envex (Env Example) is a command-line tool written in Go for generating sample dotenv files from existing `.env` files. It helps streamline the process of creating sample environment configuration files for your projects.

## Installation

### Go

You can install Envex directly from Go:

```bash
go install github.com/wickes1/envex@latest
```

### Arch User Repository (AUR)

If you're using an Arch-based Linux distribution, you can install Envex from the AUR:

```bash
yay -S envex-bin
```

## Usage

```bash
go install github.com/wickes1/envex

envex generate
# Sample dotenv file has been saved to: .env.example

# Specify input and output files
envex generate -f .env -o .env.sample

# Retain comments
envex generate -c
```

## Example

Given the following `.env` file:

```env
# Example dotenv

# Database

DB_HOST=localhost
DB_USER=root
DB_PASS=secret
DB_NAME=database

# App

APP_NAME=MyApp
APP_ENV=development
APP_DEBUG=true
APP_URL=http://localhost:8000
```

Running `envex generate` will generate the following `.env.example` file:

```env
DB_HOST=
DB_USER=
DB_PASS=
DB_NAME=
APP_NAME=
APP_ENV=
APP_DEBUG=
APP_URL=
```

Running `envex generate -c` will retain the comments:

```env
# Example dotenv

# Database

DB_HOST=
DB_USER=
DB_PASS=
DB_NAME=

# App

APP_NAME=
APP_ENV=
APP_DEBUG=
APP_URL=
```