feat: no longer using teh "hardcoded" api key

This commit is contained in:
silver 2024-11-09 12:51:41 +00:00
parent 7a6421469c
commit 015f23b922
Signed by: silver
GPG key ID: 36F93D61BAD3FD7D

View file

@ -277,25 +277,24 @@ pub mod committees {
}; };
let config = config_lock.read().await; let config = config_lock.read().await;
// TODO: proper api key management
let api_key = "";
// request data from wolves // request data from wolves
for committee in get_committees(&config, api_key).await { for committee_wolves in get_committees(&config).await {
let tmp = Committees::from(committee); let committee = Committees::from(committee_wolves);
add_committee(&db, &tmp).await; add_committee(&db, &committee).await;
} }
} }
async fn get_committees(config: &Config, wolves_api: &str) -> Vec<WolvesResultCNS> { async fn get_committees(config: &Config) -> Vec<WolvesResultCNS> {
if config.wolves_url.is_empty() { if config.wolves_url.is_empty() {
return vec![]; return vec![];
} }
// TODO: Change teh stored env value to teh base domain // TODO: Change teh stored env value to teh base domain
// TODO: this address may change
let url = format!("{}/get_cns", &config.wolves_url); let url = format!("{}/get_cns", &config.wolves_url);
// get wolves data // get wolves data
if let Ok(mut res) = surf::post(&url).header("X-AM-Identity", wolves_api).await { if let Ok(mut res) = surf::post(&url).header("X-AM-Identity", &config.wolves_api).await {
if let Ok(WolvesResult { if let Ok(WolvesResult {
success, success,
result, result,