9d21209ae8
The first part of hosting a Horizon server with one small program (docs/server.md). horizon-server is a new 1.3 MB binary with no window, GPU, audio or controller code; it runs the game headless (horizon-client --dedicated) as its engine. - horizon-server-files: server.properties, eula.txt and the user lists, moved out of horizon-client unchanged so both programs share vanilla's exact reading and writing; horizon_client::server re-exports it. - server.toml: typed settings for what owners change, [properties] for any other vanilla key, vanilla 26.3's defaults (a test checks them against ServerProperties). It is written into server.properties before every start; keys the game changes there itself (/whitelist on) are copied back afterwards, keeping the owner's comments (toml_edit). `import` turns a vanilla server.properties into server.toml. - init: the EULA (only a yes writes eula=true), world, seed, port (checked free), whitelist and first operator; every question has a flag, so it also runs unattended. - run: the console on stdin, a clean `stop` on Ctrl-C, SIGTERM or SIGHUP (the game runs in its own process group), and a restart when the game crashes: 5 s, doubling to 5 min, giving up after 5 crashes in 10 min. One supervisor per folder (a file lock). - op, deop and whitelist for a stopped server, with vanilla's messages. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
25 lines
799 B
TOML
25 lines
799 B
TOML
[package]
|
|
name = "horizon-server"
|
|
version = "0.1.0"
|
|
edition.workspace = true
|
|
license.workspace = true
|
|
rust-version = "1.90"
|
|
description = "Host a Horizon server: server.toml, the CLI and the supervisor that runs the game headless (docs/server.md)"
|
|
|
|
[dependencies]
|
|
horizon-server-files = { path = "../horizon-server-files" }
|
|
serde = { version = "1", features = ["derive"] }
|
|
toml = "1.1"
|
|
# Edits server.toml in place, keeping the owner's comments and order.
|
|
toml_edit = "0.25"
|
|
|
|
[target.'cfg(unix)'.dependencies]
|
|
# SIGINT/SIGTERM/SIGHUP: stop the game cleanly when the terminal or the service manager asks.
|
|
libc = "0.2"
|
|
|
|
[target.'cfg(windows)'.dependencies]
|
|
windows-sys = { version = "0.61", features = ["Win32_Foundation", "Win32_System_Console", "Win32_System_Threading"] }
|
|
|
|
[lints]
|
|
workspace = true
|