CityRP Documentation Repository

Environment (Env-vars)

Last updated

The CityRP env.lua (ENV) provides a wrapper for gmsv_environ, giving access to the runtime (Docker) environment variables.

API

Get environment variable

ENV:Get("name")

Returns string or nil when environment variable was not found.

Example:

local password = ENV:Get("MY_PASS")

Deployment variables

The !branch and !deploy commands (core/plugins/github/sv_init.lua) trigger this server's CD workflow on a forge through its workflow-dispatch API.

Variable Default Purpose
FORGE_PROVIDER gitea Which forge to dispatch to: gitea or github. Empty counts as unset. An unknown value logs an error and falls back to gitea.
GITHUB_API_BEARER / GITEA_API_BEARER none API token for that forge. Takes precedence over GIT_API_BEARER, so a server can hold a token for each forge and switch with FORGE_PROVIDER alone.
GIT_API_BEARER none API token for whichever forge is selected, used when its forge-specific variable is unset or empty. There is no built-in token: without one, !branch and !deploy dispatch nothing and tell the caller why. The token only needs permission to dispatch workflows.
GITHUB_API_URL / GITEA_API_URL none Dispatch URL for that forge. Takes precedence over GIT_API_URL.
GIT_API_URL The provider's cityrp2 dispatch URL Overrides the dispatch URL when the forge-specific variable is unset or empty. Must contain one %s for the workflow file name.
GIT_WORKFLOW_TO_DISPATCH cd.development.yml / cd.development2.yml / cd.development3.yml by LLServerBetaType Overrides which workflow file is dispatched.

Gameplay variables

Variable Default Purpose
SCOREBOARD_VERSION v5 The scoreboard version (v1, v2, v3, v4 or v5) the server starts on. !scoreboard v1|v2|v3|v4|v5 switches it until the next restart (Moderator S2+). An unrecognised value logs an error and falls back to v5.

HowTo: Setup environment variables (panel)

In order to pass environment variables to the runtime, you will have to register them via the Gamepanel first.

Note

If you are not a panel admin, please ask one to register the variables for you.

  1. Login to the admin interface: https://panel.limelightgaming.net/admin
  2. Click on "Nests" on the sidebar at the bottom left
  3. Select the Egg Group "Limelight"
  4. Open the Egg "Garrys Mod - CityRP" and click on "Variables"
  5. Now you can add environment variables and decide whether panel users shall view+edit them etc...

HowTo: Edit exisiting environments variables for a server

  1. Just select a server in the panel and click on the "Startup" menu.

  2. In the startup menu you can edit environment variables for that server.

Note

This only works when the admin has given view/edit permissions for these environment variables. If not, only an admin can edit them in the admin panel startup menu for that server.