reference
Variables Glenr sets
Glenr adds some environment variables to every container that needs them. This page lists each one, which resources receive it, and the names Glenr reserves so that yours do not collide.
PORT
PORT is the port your process listens on. Glenr sets it on every resource that has a port: a web service, a function, and any resource whose document declares a port. A worker, a cron job or a task with no declared port receives none. The value is the resource's port, 8080 when none is set.
Listen on $PORT on 0.0.0.0. A process bound to 127.0.0.1 accepts no traffic from the address Glenr routes to, and the readiness check fails.
app.listen(process.env.PORT, "0.0.0.0");
app.run(host="0.0.0.0", port=int(os.environ["PORT"]))
A variable or a secret named PORT is refused with PORT is set by the platform and cannot be an environment variable or PORT is set by the platform and cannot be a secret.
GLENR_PUBLIC_URL
GLENR_PUBLIC_URL is the resource's own address, https:// followed by the host. The host is the primary custom domain when the resource has one, and the generated address under apps.glenr.io otherwise. Use it where a redirect, a callback or an email link needs the address the outside world uses.
A resource with no address receives no GLENR_PUBLIC_URL: a worker, a cron job, a task and an internal service. Changing the primary custom domain restarts the resource so that it reads the new value. A resource that existed before the variable gained it receives it at its next deploy.
Database variables
A resource that names a PostgreSQL database under connects receives seven variables for that database, and the file and settings that let its driver verify the server. The seven names are the database name in capitals with dashes changed to underscores, then an underscore and a suffix. A database called maindb gives MAINDB_URL; one called my-db gives MY_DB_URL.
| Variable | Value |
|---|---|
MAINDB_HOST | The address of the instance that takes writes. |
MAINDB_PORT | 5432. |
MAINDB_DATABASE | The database name. |
MAINDB_USER | The role the resource connects as. |
MAINDB_PASSWORD | The credential. Delivered as a secret. |
MAINDB_URL | The connection string, ending in sslmode=require and sslrootcert=/etc/glenr/db/ca.crt. |
MAINDB_CA | The certificate authority as PEM text. Most drivers read a file, so use the file below. |
PGSSLROOTCERT | /etc/glenr/db/ca.crt, the path of the certificate authority file. |
NODE_EXTRA_CA_CERTS | /etc/glenr/db/ca.crt. |
PGSSLMODE | require. |
A variable of your own with one of the last three names wins: Glenr does not set it. See Connect a database for what each driver needs and for Use another name.
Variables a connection to a service sets
A resource that names another resource under connects receives <NAME>_HOST and <NAME>_PORT, with the same name rule as the database variables. See Connect one resource to another.
Variables the platform sets on a function
A function also receives K_SERVICE, K_CONFIGURATION and K_REVISION from the platform that runs functions, and its PORT is the one port it listens on. All four names are refused as variables of a function. See Functions.
Names Glenr reserves
| Name | Rule |
|---|---|
PORT | Refused as a variable and as a secret, in the console, the API and a values file. |
GLENR_ and OTEL_ | Reserved prefixes. An env: name in glenr.yaml that starts with either is refused with: the GLENR_ and OTEL_ prefixes belong to the platform; pick another name. Choose other names for variables of your own everywhere: Glenr sets GLENR_ names, and OTEL_ names belong to the platform's telemetry. |
K_SERVICE, K_CONFIGURATION, K_REVISION | Refused on a function. |
A variable name is upper-case letters, digits and underscores, and does not start with a digit.
