Special Variables
"Special Variables" are environment variables that are predefined by Zeabur and can be directly used. They can be used in Git and Prebuilt services.
Referencing
- In the environment variable input box in Zeabur: Use the
${VARIABLE}
format to insert special variables. - In your own application: Use the same method as referencing an environment variables (
process.env.VARIABLE
).
Variable Priority Order
The order of expansion for variables within a service is as follows:
- Environment variables defined by the current service will be obtained first.
- If not defined, environment variables exposed by other services will be obtained.
- If not defined, special variables will be obtained.
Variables
Hostname/Port
-
${ZEABUR_[PORTNAME]_URL}
: The URL corresponding to a specific port.-
For example,
https://test.zeabur.app
. -
This URL is that one you set in the "Domain" section:
-
-
${ZEABUR_[PORTNAME]_DOMAIN}
: The domain corresponding to a specific port.- For example,
test.zeabur.app
. - This URL is that one you set in the "Domain" section.
- For example,
-
${CONTAINER_HOSTNAME}
: The hostname of the current service in the Zeabur project.- Usually, we create an environment variable with the Expose property (e.g.,
${MYSQL_HOST}
), and then fill in the value of${CONTAINER_HOSTNAME}
in this environment variable. - However, if you want to reference the hostname of another service within Zeabur, we recommend using the DNS feature that Zeabur will release in the future.
- Usually, we create an environment variable with the Expose property (e.g.,
-
${[PORTNAME]_PORT}
: The port defined in the Prebuilt service.- For example, if you set
database / 3306 / TCP
, thenDATABASE_PORT
will be3306
. - Only visible within the current service.
- For example, if you set
Zeabur Information
These variables are not commonly used, but if you need the unique identifiers of the current Zeabur service/project, these variables will be very helpful.
${ZEABUR_SERVICE_ID}
: Service ID${ZEABUR_PROJECT_ID}
: Project ID${ZEABUR_ENVIRONMENT_ID}
: Service environment ID${ZEABUR_USER_ID}
: User ID who created this project
Git Information
These variables will only appear during the build phase of the Git service.
${ZEABUR_GIT_COMMIT_SHA}
: The Git commit SHA value that the current deployment belongs to.${ZEABUR_GIT_AUTHOR}
: The Git commit author ID that the current deployment belongs to.${ZEABUR_GIT_BRANCH}
: The Git branch name that the current deployment belongs to.${ZEABUR_GIT_REPO_NAME}
: The Git repository name that the current deployment belongs to.${ZEABUR_GIT_REPO_OWNER}
: The Git repository owner ID that the current deployment belongs to.${ZEABUR_GIT_COMMIT_MESSAGE}
: The Git commit message that the current deployment belongs to.
Utilities
${PASSWORD}
: A random password generated by Zeabur for each service.