Database & env vars
App database inspection (tables db-list · db-rows) and environment variable (env) commands
This page is for checking, right from the terminal, which tables and rows the app-dedicated DB holds — and for setting and removing app environment variables. The app-dedicated database is enabled by declaring database.engine: postgres in axhub.yaml (or via axhub apps raw-db). Data reads and writes go through the DATABASE_URL injected into the app runtime; the CLI's tables commands do read-only inspection only. The flow from enabling the DB through migrations is covered in the Connect a database.
axhub tables db-list
List the app database's tables (OAuth required).
| Flag | Type | Description | Default |
|---|---|---|---|
--app | string | App slug or id to inspect | — |
--environment | string | Read production or staging raw DB metadata | — |
axhub tables db-rows
Browse rows from one app database table (OAuth required).
| Flag | Type | Description | Default |
|---|---|---|---|
<table> | string (positional) | Raw database table name to browse | — |
--app | string | App slug or id to inspect | — |
--environment | string | Read production or staging raw DB rows | — |
--page | integer | Page number to request | — |
--per-page | integer | Number of rows per page | — |
Enabling/disabling the database lives at axhub apps raw-db enable · disable. Creating tables and writing rows is not a CLI job — use your app's migration tool and DATABASE_URL.
If the app's resource-browsing policy is locked to owners_only · locked, reads of DB rows, storage files, and environment-variable values can be refused with 403 resource_browse_restricted — even for admins.
axhub env
Manage app environment variables: list, get, set, update, and delete.
axhub env delete
Delete an environment variable.
| Flag | Type | Description | Default |
|---|---|---|---|
<key> | string (positional) | Environment variable key. | — |
--app | string | App slug or ID to operate on. | — |
--dry-run | boolean | Preview the operation without applying state changes. | true |
--execute | boolean | Apply the state-changing operation instead of previewing it. | — |
axhub env get
Get one environment variable's value.
| Flag | Type | Description | Default |
|---|---|---|---|
<key> | string (positional) | Environment variable key. | — |
--app | string | App slug or ID to operate on. | — |
axhub env list
List an app's environment variables.
| Flag | Type | Description | Default |
|---|---|---|---|
--app | string | App slug or ID to operate on. | — |
axhub env set
Set (create) an environment variable.
| Flag | Type | Description | Default |
|---|---|---|---|
<key> | string (positional) | Environment variable key. | — |
<value> | string (positional) | Environment variable value. | — |
--app | string | App slug or ID to operate on. | — |
--from-stdin | boolean | Read the value from standard input. | — |
--plain | boolean | Mark the value as plain. Mutually exclusive with --secret | — |
--secret | boolean | Mark the value as a secret. Backend masks it on read (value=***) and encrypts at rest. When set, value positional arg is disallowed; use --from-stdin instead | — |
--stage | string | Stage where this variable is available: build, runtime, or both | — |
axhub env set-staging-value
Set an environment variable's staging-only value (dry-run by default).
| Flag | Type | Description | Default |
|---|---|---|---|
<key> | string (positional) | Environment variable key. | — |
<value> | string (positional) | Environment variable value. | — |
--app | string | App slug or ID to operate on. | — |
--dry-run | boolean | Preview the operation without applying state changes. | true |
--execute | boolean | Apply the state-changing operation instead of previewing it. | — |
--from-stdin | boolean | Read the value from standard input. | — |
axhub env update
Update an existing environment variable.
| Flag | Type | Description | Default |
|---|---|---|---|
<key> | string (positional) | Env var key to update. Must already exist (otherwise ExitCode 5) | — |
<value> | string (positional) | New value, positional. Mirrors env set KEY VALUE so the two commands share a single argument shape. live-QA Gap C/E showed users hitting unexpected argument 'VALUE' because the only way to pass a value was the --value flag. --value stays as a backward-compatible alias (handler prefers positional when both are passed); pass through stdin with --from-stdin | — |
--app | string | App slug or ID to operate on. | — |
--from-stdin | boolean | Read the new value from stdin. Mutually exclusive with both positional value and the legacy --value flag — passing more than one input shape is a usage error | — |
--plain | boolean | Mark as plain on update | — |
--secret | boolean | Mark as secret on update | — |
--stage | string | Stage where this variable is available: build, runtime, or both | — |
On apps with the database enabled, DATABASE_URL · DIRECT_DATABASE_URL — and with storage enabled, STORAGE_* — are platform-injected and always win: a same-named saved variable is ignored.