diff options
-rw-r--r-- | Cargo.lock | 2 | ||||
-rw-r--r-- | Cargo.toml | 2 | ||||
-rw-r--r-- | README.md | 18 | ||||
-rw-r--r-- | src/main.rs | 4 |
4 files changed, 22 insertions, 4 deletions
@@ -1110,7 +1110,7 @@ dependencies = [ [[package]] name = "waifud" -version = "0.1.0" +version = "0.2.0" dependencies = [ "axum", "color-eyre", @@ -1,6 +1,6 @@ [package] name = "waifud" -version = "0.1.0" +version = "0.2.0" edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/README.md b/README.md new file mode 100644 index 0000000..17f47fa --- /dev/null +++ b/README.md @@ -0,0 +1,18 @@ +# Waifud + +Providing a RESTful interface to a machine's virtual machines (waifus). + +## Flake Options + +Example: + +```nix +{ config, pkgs, ... }: +{ + cara.services.waifud = { + enable = true; + environmentFileLocation = "/var/lib/waifud/.env"; + port = 3000; + }; +} +``` diff --git a/src/main.rs b/src/main.rs index d2f83a4..ba319d9 100644 --- a/src/main.rs +++ b/src/main.rs @@ -7,7 +7,7 @@ use axum::{ }; use serde::{Deserialize, Serialize}; -use std::{net::SocketAddr, time::Duration}; +use std::{net::SocketAddr, time::Duration, str::FromStr}; use tower::{BoxError, ServiceBuilder}; use tower_http::trace::TraceLayer; @@ -49,7 +49,7 @@ async fn main() { .into_inner(), ); - let addr = SocketAddr::from(([127,0,0,1], 3000)); + let addr = SocketAddr::from_str(std::env::var("BIND_ADDR").unwrap().as_str().into()).unwrap(); tracing::info!("Listening on {}", addr); axum::Server::bind(&addr) |