From 2aeca1fb7288c3126662bcae95214756142e4ddc Mon Sep 17 00:00:00 2001 From: Cole Helbling Date: Sun, 19 May 2024 13:00:01 -0700 Subject: [PATCH] Get GitHub token from file instead of static string --- ofborg/src/config.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/ofborg/src/config.rs b/ofborg/src/config.rs index 71e24bf..8f0e398 100644 --- a/ofborg/src/config.rs +++ b/ofborg/src/config.rs @@ -49,7 +49,7 @@ pub struct NixConfig { #[derive(Serialize, Deserialize, Debug, Clone)] pub struct GithubConfig { - pub token: String, + pub token_file: PathBuf, } #[derive(Serialize, Deserialize, Debug, Clone)] @@ -119,10 +119,12 @@ impl Config { } pub fn github(&self) -> Github { + let token = std::fs::read_to_string(self.github.clone().unwrap().token_file) + .expect("Couldn't read from GitHub token file"); Github::new( "github.com/grahamc/ofborg", // tls configured hyper client - Credentials::Token(self.github.clone().unwrap().token), + Credentials::Token(token), ) .expect("Unable to create a github client instance") }