refactor(self-hosting): forward every setting, drop dead config (#3047)

This commit is contained in:
Hampus authored and GitHub committed 2026-09-30 00:58:43 +02:00
1 parent 39f9beda5a
commit 2b8a743dc5
96 files changed
+1743 -2391

No files matched your search

+4 -8
View File
@@ -3,25 +3,21 @@
use crate::config::Mode;
use anyhow::Context as _;
use std::{
env,
net::{IpAddr, Ipv4Addr, Ipv6Addr, SocketAddr},
time::Duration,
};
pub async fn run(mode: Mode) -> anyhow::Result<()> {
let addr = target(
env::var("FLUXER_PUSH_SERVICE_HOST").ok().as_deref(),
env::var("FLUXER_PUSH_SERVICE_PORT").ok().as_deref(),
fluxer_svc::config::optional_env("FLUXER_PUSH_SERVICE_HOST").as_deref(),
fluxer_svc::config::optional_env("FLUXER_PUSH_SERVICE_PORT").as_deref(),
mode,
)?;
probe(addr).await
}
fn target(host: Option<&str>, port: Option<&str>, mode: Mode) -> anyhow::Result<SocketAddr> {
let host = host
.map(str::trim)
.filter(|host| !host.is_empty())
.unwrap_or("127.0.0.1");
let host = host.map(str::trim).unwrap_or("127.0.0.1");
let ip = host
.parse::<IpAddr>()
.with_context(|| format!("FLUXER_PUSH_SERVICE_HOST is not an IP address: {host}"))?;
@@ -30,7 +26,7 @@ fn target(host: Option<&str>, port: Option<&str>, mode: Mode) -> anyhow::Result<
IpAddr::V6(ip) if ip.is_unspecified() => IpAddr::V6(Ipv6Addr::LOCALHOST),
ip => ip,
};
let port = match port.map(str::trim).filter(|port| !port.is_empty()) {
let port = match port.map(str::trim) {
Some(port) => port
.parse::<u16>()
.with_context(|| format!("FLUXER_PUSH_SERVICE_PORT is not a port number: {port}"))?,
+1 -5
View File
@@ -2,7 +2,6 @@
use clap::Parser;
use fluxer_push::{cli, healthcheck, run};
use tracing_subscriber::{EnvFilter, layer::SubscriberExt, util::SubscriberInitExt};
#[tokio::main(flavor = "multi_thread")]
async fn main() -> anyhow::Result<()> {
@@ -11,10 +10,7 @@ async fn main() -> anyhow::Result<()> {
return healthcheck::run(args.mode).await;
}
tracing_subscriber::registry()
.with(EnvFilter::try_from_default_env().unwrap_or_else(|_| EnvFilter::new("info")))
.with(tracing_subscriber::fmt::layer().json())
.init();
fluxer_svc::init_tracing();
let cfg = cli::load_config(&args)?;
run(cfg).await