@@ 14,7 14,6 @@ tldr: gRPC was easier lmao.
## What's next (short-term TODO)
-- Worker configuration with CLI args.
- Actually checking auth tokens.
- Master database (redb?)
- Master web UI (leptos + leptos_oidc) for configuring workers.
@@ 19,6 19,14 @@ struct Args {
/// Enable debug logging
#[arg(long)]
debug: bool,
+
+ /// Address of the Master
+ #[arg(long, default_value = "http://127.0.0.1:8000")]
+ master_address: String,
+
+ /// Auth token
+ #[arg(long, default_value = "avain_perkele")]
+ auth_token: String,
}
#[tokio::main]
@@ 46,15 54,15 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
info!("Starting emerwen worker...");
debug!("Hello, debug!");
- // TODO: token from cli, also addr from cli
+ let channel = Channel::builder(args.master_address.parse()?)
+ .connect()
+ .await?;
- // Client is cheap to clone, clone one to every monitoring task
+ // Client is cheap to clone.
let mut client = EmerwenProtocolClient::with_interceptor(
- Channel::from_static("http://127.0.0.1:8000")
- .connect()
- .await?,
+ channel,
AuthInterceptor {
- token: "Bearer avain_perkele".parse()?,
+ token: format!("Bearer {}", args.auth_token).parse()?,
},
);