Active Application
Control which application context is used for dvs commands using the DVS_ACTIVE_APP environment variable.
Descriptionβ
The DVS_ACTIVE_APP environment variable determines which application's root directory (APP_ROOT) is mounted as /app in the container when running dvs commands. This allows you to run commands in a specific application context regardless of your current working directory.
When DVS_ACTIVE_APP is set, the active app name is also displayed in your shell prompt as (dvs:app-name) (unless disabled with DVS_PROMPT_DISABLE).
Usageβ
Set the environment variable before running dvs commands:
export DVS_ACTIVE_APP=myapp
dvs start
dvs rebuild
To unset the active app:
unset DVS_ACTIVE_APP
How It Worksβ
When DVS_ACTIVE_APP is set to a valid app name:
- DVS validates that the app exists in your configuration
- All
dvscommands execute in that application's context
If DVS_ACTIVE_APP is not set or set to an invalid app name, DVS uses your current working directory as the mount point.
Examplesβ
Activate an application for a sessionβ
# Set the active app
export DVS_ACTIVE_APP=myapp
# Run commands in the app context
dvs start
dvs logs
dvs rebuild
# The prompt shows: (dvs:myapp) user@host:~/path$
Make it persistent in your shellβ
Add to your ~/.bashrc, ~/.zshrc, or ~/.config/fish/config.fish:
# Bash/Zsh
export DVS_ACTIVE_APP=myapp
# Fish
set -gx DVS_ACTIVE_APP myapp
Switch between applicationsβ
# Work on app1
export DVS_ACTIVE_APP=app1
dvs start
# Switch to app2
export DVS_ACTIVE_APP=app2
dvs start
Unset to use current directoryβ
unset DVS_ACTIVE_APP
# Now dvs commands use your current working directory
Behaviorβ
- Environment variable:
DVS_ACTIVE_APPis read from your shell environment - Validation: DVS validates that the app exists and has a valid
APP_ROOTbefore using it - Fallback: If validation fails, DVS falls back to using your current working directory
- Prompt indicator: The active app name appears in your prompt as
(dvs:app-name)when set
Notesβ
- The variable is session-specific by default. To make it persistent, add it to your shell configuration file
- Only one app can be active at a time (the one set in
DVS_ACTIVE_APP) - The app must exist in your DVS configuration
- Use
dvs app-folder <name>to get an app's folder path
See Alsoβ
- dvs app-folder - Get an app's folder path
- Prompt Customization - Customize your shell prompt