diff --git a/flake.nix b/flake.nix index 4c45222..da477f6 100644 --- a/flake.nix +++ b/flake.nix @@ -97,7 +97,7 @@ rust-project TODO: write shell script for automatically updating `cargoHash` serviceConfig = { Type = "oneshot"; ExecStart = '' - ${cfg.package}/bin/status_cloud --config_file ${builtins.toString cfg.config_path} + ${cfg.package}/bin/status_cloud --config-file ${builtins.toString cfg.config_path} ''; }; }; diff --git a/status_cloud/src/main.rs b/status_cloud/src/main.rs index 77c94d4..8102861 100644 --- a/status_cloud/src/main.rs +++ b/status_cloud/src/main.rs @@ -55,14 +55,13 @@ fn main() -> Result<(), Box> { } - let update = Client::new() - .put(format!("https://files.nickiel.net/index.php/apps/notes/api/v1/notes/{}", cfg.note_id.clone())) + Client::new() + .put(format!("https://{}/index.php/apps/notes/api/v1/notes/{}", cfg.server_url.clone(), cfg.note_id.clone())) .header("Accept", "application/json") .header("Content-Type", "application/json") .basic_auth(cfg.user.clone(), Some(cfg.pswd.clone())) - .body(serde_json::to_string(&NoteUpdate {content: body_content}).unwrap()); - - //println!("{:#?}", update.send()?.json::()?); + .body(serde_json::to_string(&NoteUpdate {content: body_content}).unwrap()) + .send()?; Ok(()) } @@ -90,6 +89,7 @@ struct Config { user: String, pswd: String, note_id: String, + server_url: String } impl Default for Config { @@ -98,6 +98,7 @@ impl Default for Config { user: "".to_string(), pswd: "".to_string(), note_id: "".to_string(), + server_url: "".to_string(), } } }