Create .env file
Creating an .env file is a key step for managing environment variables when using
the Vault to store sensitive credentials. By specifying
public and private keys as key-value pairs in this file, you can securely enable
the vault functionality and authenticate access to stored secrets. This setup
ensures that private keys remain confidential while public keys facilitate secure
interaction with the vault, keeping credentials safe and separate from your codebase.
A .env file stores environment variables in plain text and must not contain
formatting (like RTF or Word). It should always be saved as UTF-8 plain text without
any file extension beyond .env.
|
The following instructions will guide you through creating an .env file directly
in the terminal.
Procedure
-
Go to your project directory:
cd ~/Downloads/planet9-macos-v24.14.0-rc.15. -
Create the file:
touch .env -
Open and edit it:
nano .env. -
Add key-value pair such as:
-
VAULT_ENABLED=true -
VAULT_PRIVATE_KEY=/Users/<MyUser>/<MyPath>/.keys/vault -
VAULT_PUBLIC_KEY=/Users/<MyUser>/<MyPath>/.keys/vault.pem
-
-
Verify that the
.envfile is a plain text file:file .env.Result: The terminal returns:
.env: ASCII text
Results
You have created an .env file in the terminal and confirmed that it is a plain
text file appropriate for enabling the Vault functionality and entering key-pair
public and private keys.
|
Common mistake
Using |