envenc

package module
v0.5.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 15, 2024 License: GPL-3.0 Imports: 14 Imported by: 0

README

envenc

Open in Gitpod

tests

Description

Secures your .env files with a password. Works similarly to ansible-vault.

Usage

  1. Leave your public variables in your .env file.

  2. Create a new .env.vault file using envenc.

$> ./envenc init .env.vault
  1. Add your private variables to the .env.vault file.
$> ./envenc key-set .env.vault
  1. Use the vault file in your project.
$> keys := env.KeyListFromFile(password, ".env.vault")

Installation

Installation as a standalone executable (binary)
  • Download the binary for your platform from the latest release

  • You may install it globally, or use as standalone executable

  • To use it globally on Linux, add to your $PATH

$> mkdir -p ~/.local/bin
$> cp envenc ~/.local/bin
$> chmod +x ~/.local/bin/envenc
  • To use it globally on Windows, add to your $PATH
$> mkdir -p %USERPROFILE%\.local\bin
$> cp envenc.exe %USERPROFILE%\.local\bin
Installation as a module in your project
  • Install the module with go get
$> go get github.com/gouniverse/envenc

Example Usage:

  • To create a new vault file
$> ./envenc init .env.vault
  • To set a new key-value pair
$> ./envenc key-set .env.vault
  • To list all key-value pairs
$> ./envenc key-list .env.vault
  • To remove a key-value pair
$> ./envenc key-remove .env.vault
  • To obfuscate a string
$> ./envenc obfuscate
  • To deobfuscate a string
$> ./envenc deobfuscate

TODO

Similar

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Cli

func Cli(args []string)

func Decrypt added in v0.5.0

func Decrypt(input string, password string) (string, error)

func Deobfuscate added in v0.3.0

func Deobfuscate(input string) (string, error)

Deobfuscate deobfuscates an ASCII string (not-compatible with Unicode)

Parameters:

  • input: string to deobfuscate

Returns:

  • string: deobfuscated string
  • error: error if any

func Encrypt added in v0.5.0

func Encrypt(input string, password string) (string, error)

func Init

func Init(vaultFilePath string, vaultPassword string) error

func KeyExists

func KeyExists(vaultFilePath string, vaultPassword string, key string) (bool, error)

func KeyGet

func KeyGet(vaultFilePath string, vaultPassword string, key string) (string, error)

func KeyListFromFile added in v0.5.0

func KeyListFromFile(vaultFilePath string, vaultPassword string) (map[string]string, error)

func KeyListFromString added in v0.5.0

func KeyListFromString(vaultString string, vaultPassword string) (map[string]string, error)

func KeyRemove

func KeyRemove(vaultFilePath string, vaultPassword string, key string) error

func KeySet

func KeySet(vaultFilePath string, vaultPassword string, key string, value string) error

func Obfuscate added in v0.3.0

func Obfuscate(input string) (string, error)

Obfuscate obfuscates an ASCII string (not-compatible with Unicode)

Parameters:

  • input: string to obfuscate

Returns:

  • string: obfuscated string
  • error: error if any

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL