From 998060777fd77c4f18b5e15f472bf3b9ae88444e Mon Sep 17 00:00:00 2001 From: Aravinth Manivannan Date: Thu, 29 Dec 2022 17:41:19 +0530 Subject: [PATCH] feat: switch conductor to use bearer auth --- config/default.toml | 2 +- src/conductor.rs | 2 +- src/settings.rs | 1 - 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/config/default.toml b/config/default.toml index 485b75a..40ddc01 100644 --- a/config/default.toml +++ b/config/default.toml @@ -4,7 +4,7 @@ allow_registration = true source_code = "https://git.batsense.net/LibrePages/pages" support_email = "support@librepages.example.org" conductors = [ -{ username = "librepages_api", api_key = "longrandomlygeneratedpassword", url = "http://localhost:5000"} +{ api_key = "longrandomlygeneratedpassword", url = "http://localhost:5000"} ] [server] diff --git a/src/conductor.rs b/src/conductor.rs index ef211fa..57114cf 100644 --- a/src/conductor.rs +++ b/src/conductor.rs @@ -45,7 +45,7 @@ impl Conductor { event_url.set_path("/api/v1/events/new"); self.client .post(event_url) - .basic_auth(&c.username, Some(&c.api_key)) + .bearer_auth(&c.api_key) .json(e) .send() .await diff --git a/src/settings.rs b/src/settings.rs index 77c3968..1ba746f 100644 --- a/src/settings.rs +++ b/src/settings.rs @@ -88,7 +88,6 @@ pub struct Settings { #[derive(Debug, Clone, Serialize, Deserialize)] pub struct Conductor { - pub username: String, pub api_key: String, pub url: Url, }