Add or override environment variables

Often times, while developing a service, you'll need to add an environment variable or update and existing one. Traditionally, to do so for a service that is running in Kubernetes, you would have to update your Kubernetes Deployment definition, and then redeploy the service manually.

However, with Velocity, you can add or update environment variables for services running in Kubernetes directly from your IDE.

Add env vars

To add environment variables to your service, you can simply select "Edit Configurations..." from the run configuration dropdown and then add a new environment variable or override an existing variable, like so:

Use an .env file

# Application Configuration
DEBUG=true
SECRET_KEY=mysecretkey
PORT=3000

# Database Configuration
DB_HOST=localhost
DB_PORT=5432
DB_NAME=mydatabase
DB_USER=myuser
DB_PASSWORD=mypassword

You can also supply a .env file, such as the example shown above, to add or update your running service's environment variables, as follows:

You can then restart the Velocity development session, and the new environment variables will be available in your running container.

Last updated