Thinkube GitOps

Pass configuration to your app

Values your app reads at run time, and the few the browser may see

Level
beginner
Time
30 min
Risk
low
Updated
2026-10-04

Web appConfigurationEnvironment variables

Overview

Basic idea

An app needs values it cannot know when it is written: the address it runs at, its database, a support email. Cloud platforms pass them as environment variables, set per deployment, so the same code runs anywhere and the values never enter the repository.

Thinkube does the same. The platform sets the variables it knows, such as the app’s name, address and database, and you declare your own in thinkube.yaml with a default.

  • Declared in the repository, valued at deploy. The file says a variable exists; the deployment gives it a value.

  • The browser sees only what you list. A frontend runs on the visitor’s computer, so it can read only the variables named in its publicEnv.

What you’ll accomplish

You add a variable, SUPPORT_EMAIL, to the notes app, let the browser read it, push, and find it in the backend and in the page’s configuration.

What to know before starting

Required

Optional

Supported hardware

  • GPU: not needed.

  • Architecture: amd64 or arm64: the app’s images are built for both, so it runs on any node.

Prerequisites

Platform

  • Thinkube IDE open, with ~/apps/notes in the workspace.

Components

  • None.

Instructions

Step 1. See what the page already reads

The template’s frontend reads the app’s name from the deployment, which is why the sidebar says Notes.

Ask your agent:

› show me notes' config.js

Expected output:

window.__PUBLIC_CONFIG__ = {"APP_TITLE":"Notes"};

Step 2. Declare the variable

Ask your agent:

› add SUPPORT_EMAIL to notes, default help@example.com, readable by the browser, then commit and push

The agent adds the variable under env and names it in the frontend’s publicEnv in apps/notes/thinkube.yaml:

  containers:
    - name: frontend
      publicEnv:
        - APP_TITLE
        - SUPPORT_EMAIL

  env:
    - name: SUPPORT_EMAIL
      description: "Where the app's users write for help"
      default: "help@example.com"

The commit updates the app’s deployment files for you.

The push rebuilds and redeploys the app.

Step 3. Find it in the backend and the page

Ask your agent:

› when notes is redeployed, show SUPPORT_EMAIL in the backend and in config.js

Expected output, 171 seconds after the push on the reference run:

backend SUPPORT_EMAIL=help@example.com
window.__PUBLIC_CONFIG__ = {"APP_TITLE":"Notes","SUPPORT_EMAIL":"help@example.com"};

Every container receives SUPPORT_EMAIL. The page receives only the two names in publicEnv; the database password and the other secrets the containers hold stay on the server. The frontend reads a value with publicValue('SUPPORT_EMAIL') from src/lib/publicConfig.ts.

Step 4. Next steps

To undo: Remove the variable from thinkube.yaml, commit and push.

Troubleshooting

Symptom Cause Fix

git push is rejected with ! [rejected] main → main (non-fast-forward)

After every deploy the build commits the new image tag to the repository, so your checkout is one commit behind

Run git pull --rebase, then git push again.