aboutsummaryrefslogtreecommitdiff
path: root/cmd/thoi/main.go
diff options
context:
space:
mode:
authorhistoria <[not public]>2026-09-18 21:44:49 -0400
committerhistoria <[not public]>2026-09-18 21:44:49 -0400
commite7848ea79a9a57fdf391d30c48ce649f3d2f6180 (patch)
treea2972facd5bbe88006f40ff96a1eeadd570ac15b /cmd/thoi/main.go
parenta8a67482bbff8297a96adff65d2fd7029ed998cc (diff)
downloadthehouseoficarus-e7848ea79a9a57fdf391d30c48ce649f3d2f6180.tar.gz
refactor: dedup admin entity handlers and server construction
Diffstat (limited to 'cmd/thoi/main.go')
-rw-r--r--cmd/thoi/main.go34
1 files changed, 32 insertions, 2 deletions
diff --git a/cmd/thoi/main.go b/cmd/thoi/main.go
index cf31177..915d7ca 100644
--- a/cmd/thoi/main.go
+++ b/cmd/thoi/main.go
@@ -80,7 +80,22 @@ func main() {
// Both admin transports share one UndoStack over the shared history file.
var sharedUndo *admin.UndoStack
if cfg.AdminHTTP.Enabled {
- adminSrv, err := admin.NewServer(cfg, false, g.AccountStore, g.World, g.ItemStore, g.ObjectStore, g.MobStore, dataDir, adminReloadCourses, adminRewriteRoomIDs, adminEvictRoom, adminRebuildCraftIndex, *configPath, g.RunAdminOnOwner)
+ adminSrv, err := admin.NewServer(admin.ServerDeps{
+ Config: cfg,
+ UseTLS: false,
+ Accounts: g.AccountStore,
+ World: g.World,
+ Items: g.ItemStore,
+ Objects: g.ObjectStore,
+ Mobs: g.MobStore,
+ DataDir: dataDir,
+ ReloadCourses: adminReloadCourses,
+ RewriteRoomIDs: adminRewriteRoomIDs,
+ EvictRoom: adminEvictRoom,
+ RebuildCraftIndex: adminRebuildCraftIndex,
+ ConfigPath: *configPath,
+ RunOnOwner: g.RunAdminOnOwner,
+ })
if err != nil {
log.Fatalf("failed to start admin HTTP server: %v", err)
}
@@ -97,7 +112,22 @@ func main() {
}
if cfg.AdminHTTPS.Enabled {
- adminSrv, err := admin.NewServer(cfg, true, g.AccountStore, g.World, g.ItemStore, g.ObjectStore, g.MobStore, dataDir, adminReloadCourses, adminRewriteRoomIDs, adminEvictRoom, adminRebuildCraftIndex, *configPath, g.RunAdminOnOwner)
+ adminSrv, err := admin.NewServer(admin.ServerDeps{
+ Config: cfg,
+ UseTLS: true,
+ Accounts: g.AccountStore,
+ World: g.World,
+ Items: g.ItemStore,
+ Objects: g.ObjectStore,
+ Mobs: g.MobStore,
+ DataDir: dataDir,
+ ReloadCourses: adminReloadCourses,
+ RewriteRoomIDs: adminRewriteRoomIDs,
+ EvictRoom: adminEvictRoom,
+ RebuildCraftIndex: adminRebuildCraftIndex,
+ ConfigPath: *configPath,
+ RunOnOwner: g.RunAdminOnOwner,
+ })
if err != nil {
log.Fatalf("failed to start admin HTTPS server: %v", err)
}