App Hosting Environment Variables: Deploy Secrets Safely on CM Cloud

App Hosting Environment Variables: Deploy Secrets Safely on CM Cloud

Environment variables are how production apps stay secure — your database URL, API keys, and JWT secrets never belong in your git repository. This guide shows you exactly how to add, manage, and deploy environment variables on CM Cloud App Hosting, so your Node.js, Python, Laravel, or PocketBase app ships cleanly every time.


Why Environment Variables Matter in App Hosting

Hardcoding secrets into source code is the fastest route to a breach. A single accidental public commit exposes credentials to the entire internet.

Environment variables solve this by separating configuration from code. Your app reads process.env.DATABASE_URL at runtime; the actual value lives only on the server, injected at deploy time.

On CM Cloud App Hosting, environment variables are set through the portal — not via SSH, not through config files you push. This keeps your repo clean and your secrets off GitHub permanently.


How CM Cloud App Hosting Handles Environment Variables

CM Cloud manages the full runtime layer: nginx, systemd, and process supervision. You push code only — which means the platform controls how your process starts, including which environment variables it receives.

Here is the flow:

  1. You add your variables in the CM Cloud portal under your app’s Settings → Environment.
  2. CM Cloud injects them into your app’s process at startup via the managed runtime (systemd environment block).
  3. Your app reads them normally — process.env.SECRET_KEY in Node.js, os.environ["SECRET_KEY"] in Python, env('SECRET_KEY') in Laravel.
  4. When you trigger a redeploy (via the CI/CD deploy hook or manual redeploy in the portal), the updated variables are live immediately.

No SSH access is required. No .env files go into your repo. Variables are stored encrypted at rest.


Step-by-Step: Adding Environment Variables

Step 1 — Log into the CM Cloud Portal

Navigate to App Hosting → Your App → Settings → Environment Variables.

You will see a key-value editor. Add each variable as a name/value pair.

Step 2 — Add Your Variables

Common variables to add at launch:

  • DATABASE_URL — your external database connection string
  • SECRET_KEY / APP_KEY — app-level secret (Laravel, Django, etc.)
  • JWT_SECRET — if you are using token auth
  • NODE_ENV=production or APP_ENV=production
  • PORT — CM Cloud typically sets this for you, but check your runtime docs
  • POCKETBASE_ADMIN_EMAIL / POCKETBASE_ADMIN_PASSWORD — for PocketBase deployments

Step 3 — Save and Redeploy

Save the variables in the portal. Then trigger a redeploy:

  • Manual: click Redeploy in the portal.
  • Automatic: POST to your CI/CD deploy hook URL from GitHub Actions.

The new environment is injected on the next process start. Your app picks up the updated values immediately.

Note: CM Cloud App Hosting does not include a rollback feature. Test your environment variable changes in a staging context before updating production values.


CI/CD Deploy Hook + Environment Variables: The Full Flow

One of CM Cloud’s key developer features is the CI/CD deploy hook. Generate a secret URL in the portal, then POST to it from your GitHub Actions workflow.

Here is a minimal GitHub Actions step that redeploys after a push:

- name: Trigger CM Cloud redeploy
  run: curl -X POST ${{ secrets.CMCLOUD_DEPLOY_HOOK }}

Store your CMCLOUD_DEPLOY_HOOK URL as a GitHub Actions secret — not in your repo. Your app’s runtime secrets (database URL, API keys) are already stored in CM Cloud’s portal. Your GitHub repo only holds your deploy hook URL as a GitHub secret. The result: zero secrets in source control, full automated deploys on every git push.


Runtime-Specific Notes

Node.js (Express / Next.js)

Access variables via process.env.VARIABLE_NAME. Do not commit a .env file — CM Cloud injects variables at the process level, so no dotenv library is required in production (though using dotenv for local development is fine).

Python (FastAPI / Django / Flask)

Use os.environ.get("VARIABLE_NAME") or a library like python-decouple locally. In production on CM Cloud, the variable is already present in the environment — no .env file needed.

Laravel / PHP

Laravel reads from $_ENV and getenv(). Your .env file is for local development. In production, set APP_KEY, APP_ENV=production, DB_HOST, DB_PASSWORD, and other config values directly in the CM Cloud portal. Do not push .env to git.

PocketBase

PocketBase on CM Cloud App Hosting runs as a managed runtime. Admin credentials and any custom configuration should be set via environment variables in the portal rather than hardcoded. PocketBase provides user auth, realtime subscriptions, file storage, and an admin dashboard — pair it with a Node.js or static frontend and you have a full-stack app with no secrets in your repo.


What NOT to Do

  • Do not commit .env to git — add it to .gitignore immediately.
  • Do not log environment variables — a console.log(process.env) in production exposes everything to your log output.
  • Do not rely on default values for secrets — always set SECRET_KEY, APP_KEY, and similar variables explicitly.
  • Do not share deploy hook URLs in public repos — treat them as secrets and store them in GitHub Secrets.

CM Cloud App Hosting vs Competitors

Provider Starter Price (USD) XAF EUR Environment Variables
CM Cloud App Hosting $7.99/mo XAF 5,000 €7.40 Portal UI, encrypted at rest, CI/CD hook included
Render (free tier) $7.00/mo (paid) ~XAF 4,375 ~€6.50 Portal UI — free tier sleeps after inactivity
Railway ~$5.00/mo (usage) ~XAF 3,125 ~€4.65 Portal UI — usage-based billing can spike
Heroku $5.00/mo (Eco) ~XAF 3,125 ~€4.65 Portal UI — no African infrastructure

See full pricing at cmcloudhosting.com/pricing.

CM Cloud’s key advantage for African developers: flat predictable pricing, no sleep penalties, and infrastructure built for the region. Render’s free tier kills your app after inactivity — a real problem for client demos. Railway’s usage billing can surprise you at month end. CM Cloud is $7.99/mo, period.


Supported Runtimes on CM Cloud App Hosting

  • Node.js — Express, Next.js
  • Python — FastAPI, Django, Flask
  • PHP — Laravel
  • PocketBase — full backend with auth, realtime, file storage

All runtimes are fully managed. CM Cloud handles nginx configuration, systemd process supervision, and restart-on-crash. You push code and set environment variables. That is the entire operational surface.


AI Credits for App Tooling

CM Cloud includes AI credits free on all plans, with top-ups available from $1.00 / XAF 500 / €0.93 for 25 credits.

Top-Up USD XAF EUR
25 credits $1.00 XAF 500 €0.93

Use AI credits in the portal to assist with app setup, config generation, and more.


External Database: What to Connect

CM Cloud App Hosting does not bundle a database — this is by design. You connect your own external database and pass the connection string as an environment variable (DATABASE_URL). Good options:

  • Neon (serverless Postgres, free tier)
  • PlanetScale (MySQL, free tier)
  • Supabase (Postgres + auth — though PocketBase on CM Cloud replaces this entirely)
  • Any managed PostgreSQL or MySQL instance

Passing credentials as an environment variable means they never touch your codebase.


Deploy Your App Safely Today

CM Cloud App Hosting starts at $7.99/mo (XAF 5,000 / €7.40) — a flat price with no usage spikes, no sleep penalties, and no secrets in your git history.

Visit cmcloudhosting.com/pricing to launch your app, set your environment variables securely in the portal, and connect your CI/CD pipeline with one deploy hook URL.

Your secrets stay secret. Your deploys stay automatic. Your billing stays predictable.

Scroll to Top