Quickly switch between different .env files without manually renaming them. Ideal for developers working with multiple environments like staging, production, and development.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
This extension helps you manage and quickly switch between environment files (.env, .env.production_*, .env.staging, etc.) in your VS Code workspace. It adds a button to the status bar, allowing you to easily copy the contents of any selected environment file into a .env file in the same directory.
Features
Adds a button to the VSCode status bar to select different environment files.
Allows quick replacement of .env file content with that of a selected environment file (e.g., .env.production_us, .env.staging, etc.).
Supports multiple .env.* files, including .env, .env.production_*, .env.staging, etc.
Automatically creates or overwrites the .env file in the directory of the selected file.
Usage
Open a workspace in VS Code that contains environment files (.env, .env.production_*, .env.staging, etc.).
Click on the "ENV" button in the status bar (bottom-right corner of VS Code).
A list of available environment files in the workspace and its subdirectories will appear.
Select the environment file you want to apply.
The contents of the selected file will be copied into a .env file in the same directory.
If a .env file already exists, it will be overwritten.
If no .env file exists, a new one will be created.
Example Scenario
Suppose your project contains the following files:
If you select .env.production_us, its content will replace .env.
If you navigate to a subdirectory (e.g., /my-project/backend/) that contains .env.local and select it, its content will replace /my-project/backend/.env.
Notes
If no environment files are found, an alert will notify you.
Ensure that your workspace has the necessary permissions to modify .env files.