Skip to content

Configuration

aevien@hotmail.com edited this page Aug 25, 2026 · 1 revision

Configuration

MST reads the same argument model from environment variables, command-line options, and application.cfg. Runtime configuration can override Inspector defaults, but it cannot invent server permissions or components that are absent from the scene.

Resolution Priority

For a canonical MST argument, the first available source wins:

  1. Environment variable
  2. Command-line argument
  3. Main configuration file
  4. Imported configuration file
  5. Code or Inspector default

Argument names and environment-variable names are case-sensitive according to the operating system and runtime. The environment name is generated from the argument in upper snake case. Examples:

Argument Environment variable
-mstMasterPort MST_MASTER_PORT
-mstConfigFile MST_CONFIG_FILE
-mstPermissionCredentials MST_PERMISSION_CREDENTIALS

Main Configuration File

MST loads application.cfg from the Unity project root or build root by default. Select another main file with:

-mstConfigFile=Configs/master.cfg

A relative path is resolved from the project or build root. If an explicitly selected main file is missing, startup fails with FileNotFoundException.

File Syntax

# Comments begin with #
-mstStartMaster=true
-mstMasterIp=127.0.0.1
-mstMasterPort=25200
-mstUseSecure=false

Values are split on the first =. JSON arguments must remain on one line:

-mstPermissionCredentials={"default":"client-secret","room_server":"room-secret","spawner":"spawner-secret"}

Imports

The main file can import reusable defaults:

@import "Configs/common.cfg"
@import "Configs/security.cfg"

Relative imports are resolved from the directory of the file containing the directive. Import rules are deterministic:

  • the main file wins over imported values;
  • the first imported duplicate wins;
  • duplicate parameters produce a warning;
  • the same normalized file is loaded once, preventing import cycles;
  • a missing imported file produces a warning and startup continues;
  • an invalid import directive is ignored with a warning.

Common Master Configuration

-mstStartMaster=true
-mstMasterIp=127.0.0.1
-mstMasterPort=25200
-mstTargetFrameRate=60

-mstWebAddress=127.0.0.1
-mstWebPort=25201

-mstUseSecure=false
-mstSecurityKeyRingFile=Configs/mst-security.keys.json
-mstPermissionCredentials={"default":"client-secret","room_server":"room-secret","spawner":"spawner-secret"}

-mstLogFilePath=Logs/master.log

Only include keys used by the active scene and modules. The canonical list, examples, and exact names are maintained in MstArgNames.cs.

Connection-Scoped Credentials

A non-empty credential configured directly on a connection component takes priority for its exact permission key. If it is empty, the connection falls back to -mstPermissionCredentials, then to the built-in credential for that key.

The master uses -mstPermissionCredentials only to replace credentials for permission keys already declared in its Inspector. Configuration cannot add a permission or change its numeric level.

Configuration Safety

  • Keep production and development configs separate.
  • Keep -mstUseDevMode disabled in production.
  • Use a stable, backed-up key-ring path for each production environment.
  • Update master, room, client, and spawner configs together when changing permission credentials.
  • Do not expose server-only database or platform secrets in a client build.

Clone this wiki locally