fix build on windows

Signed-off-by: Christine Dodrill <me@christine.website>
This commit is contained in:
Cadey Ratio 2021-03-03 20:07:43 -05:00
parent d978995f79
commit b10c097504
3 changed files with 218 additions and 270 deletions

479
Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -23,7 +23,6 @@ mime = "0.3.0"
prometheus = { version = "0.11", default-features = false, features = ["process"] } prometheus = { version = "0.11", default-features = false, features = ["process"] }
rand = "0" rand = "0"
reqwest = { version = "0.11", features = ["json"] } reqwest = { version = "0.11", features = ["json"] }
sdnotify = { version = "0.1", default-features = false }
serde_dhall = "0.10.0" serde_dhall = "0.10.0"
serde = { version = "1", features = ["derive"] } serde = { version = "1", features = ["derive"] }
serde_yaml = "0.8" serde_yaml = "0.8"
@ -45,6 +44,10 @@ jsonfeed = { path = "./lib/jsonfeed" }
mi = { path = "./lib/mi" } mi = { path = "./lib/mi" }
patreon = { path = "./lib/patreon" } patreon = { path = "./lib/patreon" }
# os-specific dependencies
[target.'cfg(linux)'.dependencies]
sdnotify = { version = "0.1", default-features = false }
[build-dependencies] [build-dependencies]
ructe = { version = "0.13", features = ["warp02"] } ructe = { version = "0.13", features = ["warp02"] }

View File

@ -207,6 +207,8 @@ async fn main() -> Result<()> {
.with(warp::log(APPLICATION_NAME)) .with(warp::log(APPLICATION_NAME))
.recover(handlers::rejection); .recover(handlers::rejection);
#[cfg(linux)]
{
match sdnotify::SdNotify::from_env() { match sdnotify::SdNotify::from_env() {
Ok(ref mut n) => { Ok(ref mut n) => {
// shitty heuristic for detecting if we're running in prod // shitty heuristic for detecting if we're running in prod
@ -227,7 +229,7 @@ async fn main() -> Result<()> {
})?; })?;
} }
Err(why) => error!("not running under systemd with Type=notify: {}", why), Err(why) => error!("not running under systemd with Type=notify: {}", why),
} }}
warp::serve(site) warp::serve(site)
.run(( .run((