Skip to content

System variables

Hiraiship sets these variables on every build, and attaches them to every deployed app with your runtime variables. Their values are the deployment's: a rollback brings back the old deployment's ID and commit.

KeyValue
HIRAISHIP1. Tells your code or build it runs on Hiraiship.
HIRAISHIP_ENVThe environment's name: production, staging…
HIRAISHIP_URLThe default address, https://<project>.hiraiship.app. Production only: other environments have no default address, so it isn't set there.
HIRAISHIP_PROJECT_SLUGThe project's slug.
HIRAISHIP_DEPLOYMENT_IDThe deployment's ID.
HIRAISHIP_GIT_SHAThe commit built. Set when the deployment has one: from GitHub, or hiraiship deploy in a Git repository.
HIRAISHIP_GIT_REFThe branch or tag a deployment from GitHub was asked to build.

HIRAISHIP and every key starting with HIRAISHIP_ are reserved: a variable can't take one, and --build-env refuses them.

In a frontend

Vite and Rasengan.js only hand prefixed variables to your code (VITE_, RASENGAN_), so import.meta.env.HIRAISHIP_ENV is undefined. Read them in your config file and pass them on:

vite.config.ts
import { defineConfig } from 'vite';
 
export default defineConfig({
  define: {
    'import.meta.env.VITE_HIRAISHIP_ENV': JSON.stringify(process.env.HIRAISHIP_ENV ?? 'development'),
  },
});

They count as bindings

A Worker has a limit of 128 variables and secrets; the system variables take up to 7 of them.