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;
// TODO: proper api key management
let api_key = "";
// request data from wolves
for committee in get_committees(&config, api_key).await {
let tmp = Committees::from(committee);
add_committee(&db, &tmp).await;
for committee_wolves in get_committees(&config).await {
let committee = Committees::from(committee_wolves);
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() {
return vec![];
}
// TODO: Change teh stored env value to teh base domain
// TODO: this address may change
let url = format!("{}/get_cns", &config.wolves_url);
// 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 {
success,
result,