/ ____\ \ / / \ | |/ ____| /\ | | | | | ____| \ | \ \ / / ____|
| (___ \ \_/ /| \| | | / \ | | | | | |__ | \| |\ \ / / (___
\___ \ \ / | . ` | | / /\ \ | | | | | __| | . ` | \ \/ / \___ \
____) | | | | |\ | |____ / ____ \| |____| |____ | |____| |\ | \ / ____) |
|_____/ |_| |_| \_|\_____| /_/ \_\______|______| |______|_| \_| \/ |_____/
SYNC ALL ENVS is an extension that helps you sync all your *.env files based on a template.
There are 3 commands available on this extension:
This function allows you to sync all your *.env files in your working directory with the .env template.
This function allows you to sync only a selected *.env file in your working directory with .env template.
This function allows you to sync files from the same family (root name).
x.env
: x is the family root namex-1.env
: belongs to family 'x'
To create families, keep the same root name and separate the name with a '-'.
Example: In a repo where there are the following files:
ex.env ex-1.env ex-2.env ase.env ase-local.env
There are 2 families: ex and ase
and ex.env and ase.env
are the parents of these families.
After selecting which family to sync, the family files will be synced with the .env parent file of that family
This command will request for 2 inputs:
- 1- target .env file
- 2- reference .env file
The command will generate a copy of the target file with only the keys that are different from the reference .env file.
The template env file and the target files must be located on the working directory.
By default, the template env file is named .env.template
. This can be changed to a different template file on the extension settings.
By default, the target env filename pattern is *.env
. Therefore any file with this pattern except .env
will be used for syncing. This can be changed to a different pattern file name on the extension settings. This means that files with names such as vm.env
, machine1.env
and deployment.env
will be found by the extension.
This extension contributes the following settings:
-
syncallenvs.templateFilename
: specifies the filename template to be used as base to sync other files, by default the template filename is.env.template
-
syncallenvs.targetFilenamePattern
: specifies filename pattern of the filename to be used to by synced with the template file, by default the target filename pattern is*.env
Initial release of SyncAllEnvs with sync all *.env files, sync selected *.env file and allowing user to customize template env file and target env files pattern
Fixing bug where values with =
were cut off because it matched separator
Adding capability to sync family .env files
Adding capability to generate env file with only unique keys different from selected template
Enjoy!