GitHub Action
Ennbu Action
ennbu
is a command-line interface (CLI) tool for managing .env files in your projects, written in Go. It allows you to easily set, replace, list, and get values of keys within your .env files.
- Get a specific key-value pair from a .env file
- List all key-value pairs in a .env file
- Set a new value for a key in a .env file, creating the key if it doesn't exist
- Replace a value for an existing key in a .env file
There are several ways to install ennbu:
- Using Go To install ennbu with Go, make sure you have Go installed on your system, and then run:
go install github.com/u-yas/ennbu@latest
- Downloading from GitHub Releases
curl -L -o ennbu https://github.com/u-yas/ennbu/releases/download/v0.0.1/ennbu-linux-x86_64.tar.gz
sudo mv ennbu /usr/local/bin/
- Using Docker
docker run -it -v "$(pwd):/workdir" ghcr.io/u-yas/ennbu:latest <command>
- Github Action
---
name: "golang testing"
on:
pull_request:
branches:
- main
jobs:
build:
timeout-minutes: 15
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
with:
go-version-file: "./go.mod"
- name: go mod download
run: go mod download
- name: replace APP_ENV
uses: u-yas/ennbu@v0.0.4
with:
envPath: .env
commands: |
set -k APP_ENV test
list --json
- name: go test
run: go test ./...
To get the value of a specific key in a .env file, use the get
command:
ennbu get KEY_NAME -f .env
--unescape
or -u
# .env
KEY_NAME="aa\nbbb\n\tccc"
# normally
ennbu get KEY_NAME
# aa\nbbb\nccc
# unescape
ennbu get KEY_NAME -u
#aa
#bb
#cc
To list all key-value pairs in a .env file, use the list
command:
ennbu list -f .env
To list the key-value pairs in JSON format, use the --json
flag:
ennbu list --json -f .env
To set a new value for a key in a .env file, use the set
command:
ennbu set -f .env -k KEY_NAME VALUE
To replace a value for an existing key in a .env file, use the replace
command:
echo NEW_VALUE | ennbu replace -f .env -k KEY_NAME
--escape
flags escape value
ennbu set -k A "aaa
bbb
cc"
A="aaa\nbbb\n\ncc"
--importFile
flags enabled, read content from args
ennbu set -k PRIVATE_KEY --importFile ~/.ssh/id_ed25519 --escape
PRIVATE_KEY="-----BEGIN OPENSSH PRIVATE KEY-----\\nxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\\n-----END OPENSSH PRIVATE KEY-----"
Contributions are welcome! Please feel free to submit a pull request or open an issue.