envlock-cli is a powerful command-line tool for securely managing .env file templates. The application allows you to store configuration templates locally on your computer, protect them with passwords and encryption, and quickly integrate them into new projects, saving time on environment setup. Each template can be protected with a unique password, providing flexible access control for different projects. Thanks to the container system, you can logically isolate templates by project or environment (e.g., frontend, backend, staging), quickly switch between them, and ensure that settings from different projects never get mixed up.
# 1. Set a master password
el password
# 2. Create a project container (for example, 'shop')
el container shop
el switch shop
# 3. Save the current .env file as a template with a unique password
el save shop_base --file ./.env --description "Shop database .env"
# 4. Restore the template in the new project
el write shop_base ./new-shop/.env --overwritegit clone https://github.com/soirrex/envlock-cli.git
cd ./envlock-cli
npm i
npm run build
npm i -g .
npm i -g envlock-cli
npm uni -g envlock-cli
If you encounter an error related to a mismatch in database fields, use the following command:
el dbalter-
Get commands help:
Get help for all commands:el -h
-
Get help for a specific command:
Get help for a specific command:el -h <command>
The password that will be used for encryption and decryption by default
-
Set password:
Set the password for encryption:el password
-
Remove password:
Remove password:el password -r
Use containers to isolate templates from one another, once you select a specific container, all operations on the templates will be performed within that container. By default, the container is set to "null".
-
Create container:
Create a new container:el container <name>
-
Get all containers:
Get all your containers:el containers
-
Switch to another container:
Switch from the current container to another one:el switch <containerName>
-
Update container:
Update container by name:el uc <containerName> <newContainerName>
-
Remove container:
Remove container by name:el rmc <containerName>
-
Save template:
-
Create a new template:
el save <name> --description <description>
-
Copy the file to the template:
Save the existing file as a template:el save <name> --file <path> --description <description>
If you want to use a different password for encryption, you can specify it with the
--passwordoption. -
-
Get templates:
-
Get all templates:
Get a list of all templates:el get
If you want to get all templates from all containers, you can specify it with the
--containersoption. -
Get a template by name:
Get a specific template:el get --name <name>
If you want to use a different password for decryption, you can specify it with the
--passwordoption.
-
-
Update template by name:
-
Update template data by name:
el update <name> --name <newName> --description <newDescription>
-
Update template content:
Update the encrypted data in the template:el update <name> --content
If you want to use a different password for decryption, you can specify it with the
--passwordoption.
You cannot use all flags in a command at the same time, if you use
el update <name> --name <newName> --description <newDescriptio> --content, the--contentflag will always take precedence when all flags are used together, and the other flags will be ignored -
-
Save the template to a file:
Save the template to the specified file:-
Add the following template to the end of the file:
el write <name> <path>
-
Overwrite the file with the template:
el write <name> <path> --overwrite
If you want to use a different password for decryption, you can specify it with the
--passwordoption. -
-
Move template to another container:
Move template to another container:el move <templateName> <containerName>
-
Remove template:
Remove a specific template:el remove <name>