Skip to main content

tuwunel_admin/server/
mod.rs

1mod admin_notice;
2mod backup_database;
3mod clear_caches;
4mod list_backups;
5mod list_features;
6mod memory_usage;
7mod rebuild_relation_index;
8mod reload_config;
9mod reload_mods;
10#[cfg(unix)]
11mod restart;
12mod show_config;
13mod shutdown;
14mod uptime;
15
16use std::path::PathBuf;
17
18use clap::Subcommand;
19use tuwunel_core::Result;
20
21use crate::admin_command_dispatch;
22
23#[admin_command_dispatch]
24#[derive(Debug, Subcommand)]
25pub(super) enum ServerCommand {
26	/// - Time elapsed since startup
27	Uptime,
28
29	/// - Show configuration values
30	ShowConfig,
31
32	/// - Reload configuration values
33	ReloadConfig {
34		path: Option<PathBuf>,
35	},
36
37	/// - List the features built into the server
38	ListFeatures {
39		#[arg(short, long)]
40		available: bool,
41
42		#[arg(short, long)]
43		enabled: bool,
44
45		#[arg(short, long)]
46		comma: bool,
47	},
48
49	/// - Print database memory usage statistics
50	MemoryUsage,
51
52	/// - Clears all of Tuwunel's caches
53	ClearCaches,
54
55	/// - Rebuild the typed relation index (relatesto_typed) from all PDUs
56	RebuildRelationIndex,
57
58	/// - Performs an online backup of the database (only available for RocksDB
59	///   at the moment)
60	BackupDatabase,
61
62	/// - List database backups
63	ListBackups,
64
65	/// - Send a message to the admin room.
66	AdminNotice {
67		message: Vec<String>,
68	},
69
70	/// - Hot-reload the server
71	#[clap(alias = "reload")]
72	ReloadMods,
73
74	#[cfg(unix)]
75	/// - Restart the server
76	Restart {
77		#[arg(short, long)]
78		force: bool,
79	},
80
81	/// - Shutdown the server
82	Shutdown,
83}