env
Switch the active environment for your project.
The switch env command changes the default environment in your local project configuration.
Usage#
redenv switch env [--env <environment>]Options#
| Flag | Description |
|---|---|
-e, --env <env> | Specify environment (interactive selection if omitted) |
Examples#
Switch interactively#
redenv switch envSwitch to specific environment#
redenv switch env --env production
# or
redenv switch env -e stagingInteractive Flow#
The selector shows all existing environments plus an option to create a new one:
$ redenv switch env
? Select environment:
❯ development
staging
production
New environment
✔ Switched to 'staging' environment.Creating a New Environment#
Select "New environment" to create one on the fly:
$ redenv switch env
? Select environment: New environment
? Enter environment name: qa
✔ Switched to 'qa' environment.Warning
Switching to a new environment only updates your local config file. The
environment is not created in the remote store until you add a secret to it.
Until then, the environment exists only in redenv.config.ts.
What Changes#
The command updates your local redenv.config.ts:
import { defineConfig } from "@redenv/core";
export default defineConfig({
name: "my-app",
environment: "staging", // Changed from "development"
});This affects all subsequent commands that don't specify --env.