Skip to content
| Marketplace
Sign in
Visual Studio Code>Other>SwitchEnvNew to Visual Studio Code? Get it now.
SwitchEnv

SwitchEnv

Rohit Vishwakarma

|
7 installs
| (0) | Free
Quickly switch environment configurations for projects by selecting presets stored in custom folders.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

SwitchEnv README

SwitchEnv is a Visual Studio Code extension designed to simplify the process of switching between different environment configurations in a project. This extension helps you quickly swap .env files with presets for various environments like local, dev, qa, stage, etc.. enabling smoother transition across project in the same workspace.

Features

  • Environment Switching: Easily switch between predefined environment configurations withing your project be it single project or monorepo.

  • Multiple Project Support: Automatically identifies projects with .env files and applies selected environment presets to each.

  • Customizable Environments: Add custom environment options (e.g. dev, qa, stage) in the extension settings (switchEnv.envNames).

  • Folder Ignoring: Specify folders to ignore during environment switching, useful for skipping unnecessary directories (switchEnv.ignoreFolders).

  • Custom Environment Folder and Patterns: Specufy a custom folder for environment presets and define pattern for environment files.

Example Usage

  1. Place environment preset files in an environments folder next to each .env file:
/projectA
    |--- .env
    |--- environments/
        |--- local.env
        |--- dev.env
        |--- qa.env
        |--- stage.env

  1. Configure environment options and ignorable folders in extension settings (more below).
  2. Click the SwitchEnv button in the status bar to select the environment or hit cmd + shift + p and search SwitchEnv hit enter. You will be prompted to select a environment from a list of environments you defined in switchEnv.envNames variable in settings.json. Select an environment from list and then the content of .env files will automatically updated with the selected preset values.
  3. Be sure to add your environment folder to .gitignore. For instance, if the folder is named environments, include environments/ in your project's .gitignore or global .gitignore to prevent those files from being pushed to the repository.

Demo

Requirements

No special dependencies are required. Ensure that you have .env and environments files properly structured as described for optimal use.

Extension Settings

SwitchEnv provides the follwing settings to customize behavior:

  • switchEnv.envNames: Defines a list of environments available for switching. Default: ["local", "dev", "qa", "stage"].
  • switchEnv.ignoreFolders: Specifies folders to ignore when switching environments. Useful for excluding non-environment-related folders in your project. Default: ["node_modules", "dist"].
  • switchEnv.envFolder: Specifies the folder where environment presets files are stored. Default: "environments".
  • switchEnv.envFilePattern: Defines the pattern for environment files. Default: ".env".

Release Notes

1.0.0

Initial release of SwitchEnv

Suggesting Improvements

To file bugs, make feature requests, or to suggest other improvements, please use github's issue tracker


Want to support my work

  1. Buy me a coffee! ☕️

  2. Star this repository ⭐️⭐️⭐️


Made with ♥️ by Rohit Vishwakarma

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2025 Microsoft