use api key from file (todo? envvar fallback)

pull/5/head
Mingwei Samuel 2019-10-17 16:56:31 -07:00
parent 2d105529b4
commit 22da3abc0d
2 changed files with 7 additions and 4 deletions

3
.gitignore vendored
View File

@ -1,4 +1,5 @@
/target /target
**/*.rs.bk **/*.rs.bk
Cargo.lock
/doc /doc
Cargo.lock
apikey.txt

View File

@ -14,12 +14,14 @@ mod tests {
use tokio::runtime::Runtime; use tokio::runtime::Runtime;
use super::*; use super::*;
const API_KEY: &'static str = "RGAPI-nothinghereowo";
#[test] #[test]
fn it_works() { fn it_works() {
let api_key_raw = std::fs::read_to_string("apikey.txt").unwrap(); // TODO don't use unwrap.
let api_key = api_key_raw.trim();
let rt = Runtime::new().unwrap(); let rt = Runtime::new().unwrap();
let riot_api = RiotApi::with_key(API_KEY); let riot_api = RiotApi::with_key(api_key);
// https://na1.api.riotgames.com/lol/champion-mastery/v4/scores/by-summoner/SBM8Ubipo4ge2yj7bhEzL7yvV0C9Oc1XA2l6v5okGMA_nCw // https://na1.api.riotgames.com/lol/champion-mastery/v4/scores/by-summoner/SBM8Ubipo4ge2yj7bhEzL7yvV0C9Oc1XA2l6v5okGMA_nCw
let my_future = riot_api.get::<u32>("asdf", consts::Region::NA, let my_future = riot_api.get::<u32>("asdf", consts::Region::NA,