Configuration Guide
This guide reflects the current runtime behavior in Moongate v2.
Configuration Sources
Priority order:
- Command-line arguments
- Environment variables
moongate.jsonin root directory- Defaults
Command-Line Arguments
Current Program command signature supports:
--showHeader(bool, defaulttrue)--rootDirectory(string)--uoDirectory(string)--loglevel(LogLevelType, defaultDebug)
Example:
dotnet run --project src/Moongate.Server -- \
--rootDirectory /opt/moongate \
--uoDirectory /opt/uo \
--loglevel Information
Environment Variables
Currently used by bootstrap/runtime:
MOONGATE_ROOT_DIRECTORYMOONGATE_UO_DIRECTORYMOONGATE_ADMIN_USERNAMEMOONGATE_ADMIN_PASSWORD
MOONGATE_ROOT_DIRECTORY is used if --rootDirectory is not passed.
MOONGATE_UO_DIRECTORY is required if --uoDirectory is not passed.
moongate.json
Location:
<RootDirectory>/moongate.json
If missing, bootstrap creates one with default values.
Important Current Limitation
At the moment, bootstrap explicitly applies these fields from file:
RootDirectoryUODirectoryLogLevelLogPacketDataPersistence
Other sections exist in the config model (Http, Game, Metrics), but are not explicitly merged in CheckConfig() yet.
Config Model
Top-level shape:
{
"rootDirectory": "/opt/moongate",
"uoDirectory": "/opt/uo",
"logLevel": "Information",
"logPacketData": true,
"isDeveloperMode": false,
"http": {
"isEnabled": true,
"port": 8088,
"isOpenApiEnabled": true
},
"game": {
"shardName": "Moongate Shard",
"timerTickMilliseconds": 250,
"timerWheelSize": 512,
"idleCpuEnabled": true,
"idleSleepMilliseconds": 1
},
"metrics": {
"enabled": true,
"intervalMilliseconds": 1000,
"logEnabled": true,
"logToConsole": false,
"logLevel": "Trace"
},
"persistence": {
"saveIntervalSeconds": 30
}
}
Directories
DirectoriesConfig auto-creates directory tree under root using DirectoryType values:
datatemplatesscriptssavelogscachedatabase
HTTP Endpoints
When HTTP is enabled:
/→ plain text service banner/health→ plain textok/metrics→ Prometheus text format (if metrics factory configured)/scalarand/openapi/*(if OpenAPI enabled)
Persistence Setting
Only persistence knob currently exposed:
Persistence.SaveIntervalSeconds(autosave interval)
Docker Notes
For container runs, typical environment:
MOONGATE_ROOT_DIRECTORY=/app
MOONGATE_UO_DIRECTORY=/uo
Mount /app for runtime data and /uo for UO client files.
Previous: Installation Guide | Next: Quick Start