aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/handlers/planets.rs12
-rw-r--r--src/main.rs3
2 files changed, 14 insertions, 1 deletions
diff --git a/src/handlers/planets.rs b/src/handlers/planets.rs
index a57f605..ede7b2b 100644
--- a/src/handlers/planets.rs
+++ b/src/handlers/planets.rs
@@ -64,3 +64,15 @@ pub async fn pause(Path(uuid): Path<String>) -> NoneResult {
Ok(())
}
+
+pub async fn reboot(Path(uuid): Path<String>) -> NoneResult {
+ let mut s = get_star()?;
+
+ if let Ok(p) = s.find_planet(uuid) {
+ p.reboot()?;
+ } else {
+ return Err(ServiceError::NotFound);
+ }
+
+ Ok(())
+}
diff --git a/src/main.rs b/src/main.rs
index 28036d4..b962764 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -27,7 +27,7 @@ async fn main() {
tracing_subscriber::registry()
.with(tracing_subscriber::EnvFilter::new(
std::env::var("RUST_LOG")
- .unwrap_or_else(|_| "waifud=info,tower_http=debug".into()),
+ .unwrap_or_else(|_| "solard=info,tower_http=debug".into()),
))
.with(tracing_subscriber::fmt::layer())
.init();
@@ -39,6 +39,7 @@ async fn main() {
.route("/planets/:uuid/shutdown", post(handlers::planets::shutdown))
.route("/planets/:uuid/start", post(handlers::planets::start))
.route("/planets/:uuid/pause", post(handlers::planets::pause))
+ .route("/planets/:uuid/reboot", post(handlers::planets::reboot))
.layer( ServiceBuilder::new()
.layer(HandleErrorLayer::new(|error: BoxError| async move {
if error.is::<tower::timeout::error::Elapsed>() {