### Install envchain from Source Source: https://github.com/sorah/envchain/blob/master/README.md Build and install envchain from its source code. Ensure you have the necessary build tools. ```bash $ make $ sudo make install (or) $ cp ./envchain ~/bin/ ``` -------------------------------- ### Build and Install envchain from Source Source: https://context7.com/sorah/envchain/llms.txt Clone the repository, build the executable using make, and then install it system-wide or to a local bin directory. ```bash git clone https://github.com/sorah/envchain.git cd envchain make sudo make install # — or — install to ~/bin without sudo cp ./envchain ~/bin/ ``` -------------------------------- ### Install envchain with Homebrew Source: https://github.com/sorah/envchain/blob/master/README.md Install envchain using the Homebrew package manager on macOS. ```bash brew install envchain ``` -------------------------------- ### Install Linux Dependencies for envchain Source: https://context7.com/sorah/envchain/llms.txt Install the necessary development libraries for building envchain from source on Debian/Ubuntu or Fedora/RHEL systems. ```bash # Debian / Ubuntu sudo apt-get install libreadline-dev libsecret-1-dev # Fedora / RHEL sudo dnf install readline-devel libsecret-devel ``` -------------------------------- ### Build and Install Envchain Source: https://context7.com/sorah/envchain/llms.txt Builds the envchain binary from source and provides options for installation to custom prefixes using the DESTDIR variable. Clean build artifacts with 'make clean'. ```bash # Build the envchain binary (output: ./envchain) make ``` ```bash # Clean build artifacts make clean ``` ```bash # Install to /usr/bin/envchain (default DESTDIR=/usr) sudo make install ``` ```bash # Install to a custom prefix, e.g. /usr/local sudo make install DESTDIR=/usr/local ``` ```bash # Install to user home directory without sudo make && cp ./envchain ~/bin/ ``` -------------------------------- ### Execute Commands with envchain Variables Source: https://github.com/sorah/envchain/blob/master/README.md Run commands with environment variables loaded from a specified namespace. This example shows how to list AWS variables or execute a command like 's3cmd'. ```bash $ env | grep AWS_ || echo "No AWS_ env vars" No AWS_ env vars $ envchain aws env | grep AWS_ AWS_ACCESS_KEY_ID=my-access-key AWS_SECRET_ACCESS_KEY=secret $ envchain aws s3cmd blah blah blah ⋮ ``` ```bash $ envchain hubot env | grep AWS_ || echo "No AWS_ env vars for hubot" No AWS_ env vars for hubot $ envchain hubot env | grep HUBOT_ HUBOT_HIPCHAT_PASSWORD: xxxx ``` ```bash $ envchain aws,hubot env | grep 'AWS_\|HUBOT_' AWS_ACCESS_KEY_ID=my-access-key AWS_SECRET_ACCESS_KEY=secret HUBOT_HIPCHAT_PASSWORD: xxxx ``` -------------------------------- ### List Available Namespaces with envchain Source: https://github.com/sorah/envchain/blob/master/README.md Display all namespaces that have been created using envchain. ```bash $ envchain --list aws hubot ``` -------------------------------- ### List Namespaces and Variables Source: https://context7.com/sorah/envchain/llms.txt Lists all stored namespace names or, with a namespace argument, lists the environment variable keys within that namespace. Use --show-value to display variable values. ```bash # List all namespaces $ envchain --list aws github hubot ``` ```bash # Short form $ envchain -l ``` ```bash # List variable keys stored under the "aws" namespace $ envchain --list aws AWS_ACCESS_KEY_ID AWS_SECRET_ACCESS_KEY ``` ```bash # List variable keys and their values $ envchain --list --show-value aws AWS_ACCESS_KEY_ID=AKIAIOSFODNN7EXAMPLE AWS_SECRET_ACCESS_KEY=wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY ``` ```bash # Short flags $ envchain -l -v aws ``` -------------------------------- ### Run Command with Multiple Namespaces Source: https://context7.com/sorah/envchain/llms.txt Injects environment variables from multiple comma-separated namespaces into a command. Useful for commands that require credentials from different services. ```bash $ envchain aws,github env | grep -E 'AWS_|GITHUB_' AWS_ACCESS_KEY_ID=AKIAIOSFODNN7EXAMPLE AWS_SECRET_ACCESS_KEY=wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY GITHUB_TOKEN=ghp_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx ``` -------------------------------- ### Store GitHub Token in 'github' Namespace Source: https://context7.com/sorah/envchain/llms.txt Use the --set flag to store a GitHub token under the 'github' namespace. The '-s' flag is a shorthand for '--set'. ```bash # Store a single token under the "github" namespace $ envchain --set github GITHUB_TOKEN github.GITHUB_TOKEN: ghp_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx # Aliases: -s is shorthand for --set $ envchain -s aws AWS_ACCESS_KEY_ID AWS_SECRET_ACCESS_KEY ``` -------------------------------- ### Save Environment Variables with envchain Source: https://github.com/sorah/envchain/blob/master/README.md Set environment variables within a specified namespace. You will be prompted to enter the values for each variable. ```bash envchain --set NAMESPACE ENV [ENV ..] ``` ```bash $ envchain --set aws AWS_ACCESS_KEY_ID AWS_SECRET_ACCESS_KEY aws.AWS_ACCESS_KEY_ID: my-access-key aws.AWS_SECRET_ACCESS_KEY: secret ``` ```bash $ envchain --set hubot HUBOT_HIPCHAT_PASSWORD hubot.HUBOT_HIPCHAT_PASSWORD: xxxx ``` -------------------------------- ### Execute Command with Injected Secrets Source: https://context7.com/sorah/envchain/llms.txt Run a command with secrets from a specified namespace injected as environment variables. The secrets are only available to that specific process. ```bash # Confirm no AWS vars are present normally $ env | grep AWS_ || echo "No AWS_ env vars" No AWS_ env vars # Run env(1) with AWS credentials injected $ envchain aws env | grep AWS_ AWS_ACCESS_KEY_ID=AKIAIOSFODNN7EXAMPLE AWS_SECRET_ACCESS_KEY=wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY # Run a real AWS CLI command with credentials from the vault $ envchain aws aws s3 ls s3://my-bucket # Run a deployment script with GitHub credentials injected $ envchain github ./deploy.sh --env production ``` -------------------------------- ### Store Hubot Password in 'hubot' Namespace Source: https://context7.com/sorah/envchain/llms.txt Use the --set flag to store a Hubot password under the 'hubot' namespace. ```bash # Store a bot password under the "hubot" namespace $ envchain --set hubot HUBOT_HIPCHAT_PASSWORD hubot.HUBOT_HIPCHAT_PASSWORD: s3cr3t! ``` -------------------------------- ### Force Passphrase Prompt Source: https://github.com/sorah/envchain/blob/master/README.md Use --require-passphrase to always prompt for the keychain passphrase when setting a variable. ```bash $ envchain --set --require-passphrase name ``` -------------------------------- ### Store AWS Credentials in 'aws' Namespace Source: https://context7.com/sorah/envchain/llms.txt Use the --set flag to interactively store AWS access key ID and secret access key under the 'aws' namespace. Values are not echoed or stored in history. ```bash $ envchain --set aws AWS_ACCESS_KEY_ID AWS_SECRET_ACCESS_KEY aws.AWS_ACCESS_KEY_ID: AKIAIOSFODNN7EXAMPLE aws.AWS_SECRET_ACCESS_KEY: wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY ``` -------------------------------- ### Control Keychain Passphrase Prompting (macOS) Source: https://context7.com/sorah/envchain/llms.txt Use --require-passphrase (-p) to force a passphrase prompt on access, or --no-require-passphrase (-P) to disable it. This is macOS-specific. ```bash # Always prompt for keychain passphrase when this secret is read $ envchain --set --require-passphrase aws AWS_SECRET_ACCESS_KEY aws.AWS_SECRET_ACCESS_KEY: wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY # Never prompt for keychain passphrase (trusted app access) $ envchain --set --no-require-passphrase aws AWS_ACCESS_KEY_ID aws.AWS_ACCESS_KEY_ID: AKIAIOSFODNN7EXAMPLE # Short flags $ envchain -s -p aws AWS_SECRET_ACCESS_KEY $ envchain -s -P aws AWS_ACCESS_KEY_ID ``` -------------------------------- ### Disable Passphrase Prompt Source: https://github.com/sorah/envchain/blob/master/README.md Use --no-require-passphrase to disable the automatic prompt for the keychain passphrase when setting a variable. ```bash $ envchain --set --no-require-passphrase name ``` -------------------------------- ### Set Variable without Echoing Input Source: https://github.com/sorah/envchain/blob/master/README.md Use the --noecho option to prevent envchain from echoing the input value when setting a variable. ```bash $ envchain --set --noecho foo BAR foo.BAR (noecho): ``` -------------------------------- ### Store Secrets Without Echoing Input Source: https://context7.com/sorah/envchain/llms.txt Use the --noecho flag (or -n) to disable terminal echo while typing secret values. This requires stdin to be a TTY and is useful for complete input privacy. ```bash # The typed value is completely hidden (no characters shown) $ envchain --set --noecho aws AWS_SECRET_ACCESS_KEY aws.AWS_SECRET_ACCESS_KEY (noecho): # Short flags combined $ envchain -s -n github GITHUB_TOKEN github.GITHUB_TOKEN (noecho): ``` -------------------------------- ### Remove Stored Variables Source: https://context7.com/sorah/envchain/llms.txt Deletes one or more environment variable entries from a specified namespace. The namespace is automatically removed when its last variable is deleted. ```bash # Remove a single variable from the "aws" namespace $ envchain --unset aws AWS_SECRET_ACCESS_KEY ``` ```bash # Remove multiple variables at once $ envchain --unset aws AWS_ACCESS_KEY_ID AWS_SECRET_ACCESS_KEY ``` ```bash # Remove a variable from another namespace $ envchain --unset hubot HUBOT_HIPCHAT_PASSWORD ``` ```bash # Verify removal $ envchain --list github ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.