Managing Application Environment Variables

Environment variables let you pass configuration to your application without hardcoding sensitive values — such as database passwords, API keys, or feature flags — directly into your source code. CyclebreezeHost's Setup Node.js App and Setup Python App tools in cPanel include a dedicated section for managing these variables safely.

Configure environment variables for your app safely.

Why Use Environment Variables

Storing configuration in environment variables instead of code files gives you several advantages:

  • Security — secrets never appear in version control or shared repositories.
  • Portability — the same codebase runs in development and production with different configurations.
  • Ease of change — you can update a value without modifying or redeploying your code.

Accessing the Environment Variables Section

  1. Log in to cPanel and open Setup Node.js App or Setup Python App under the Software section.
  2. Click the edit (pencil) icon next to your existing application, or open its configuration page.
  3. Scroll down to the Environment Variables section.

Adding a Variable

  1. Click Add Variable (or the + button, depending on your cPanel version).
  2. Enter the variable Name — use uppercase with underscores, e.g., DATABASE_URL.
  3. Enter the Value — the actual secret or configuration string.
  4. Click Save or the checkmark to confirm.
  5. Repeat for each variable you need.

Important: After adding or editing variables, click the main Save button for the application, then Restart the app so the new values are loaded into the running process.

Common Variables by Framework

VariableExample ValueUsed By
NODE_ENVproductionNode.js (Express, etc.)
PORT3000Node.js (set automatically by Passenger)
DATABASE_URLmysql://user:pass@localhost/dbnameNode.js, Python
SECRET_KEYrandom stringDjango, Flask
DJANGO_SETTINGS_MODULEmyproject.settings.productionDjango
JWT_SECRETrandom stringAny JWT-based API
API_KEYthird-party keyAny external service

Editing an Existing Variable

  1. Locate the variable in the list.
  2. Click the edit icon next to it.
  3. Update the value and click Save.
  4. Restart your application to apply the change.

Deleting a Variable

  1. Click the delete (bin) icon next to the variable you want to remove.
  2. Confirm the deletion.
  3. Restart your application.

Removing a variable that your application still reads will likely cause a runtime error, so verify your code no longer references the variable before deleting it.

Accessing Variables in Your Code

Node.js

const dbUrl = process.env.DATABASE_URL;
const secretKey = process.env.SECRET_KEY;

Python

import os

db_url = os.environ.get("DATABASE_URL")
secret_key = os.environ.get("SECRET_KEY")

Use os.environ.get("KEY") rather than os.environ["KEY"] in Python to avoid a KeyError if the variable is missing — it returns None instead.

Security Best Practices

  • Never commit a .env file containing real secrets to version control.
  • Rotate secrets immediately if they are accidentally exposed.
  • Use a unique SECRET_KEY or JWT_SECRET per environment — do not share keys between staging and production.
  • Restrict database user permissions to only the operations your app actually needs.

If you need help configuring your application's environment, contact CyclebreezeHost support at info@cyclebreezehost.com — available 24/7.