aboutsummaryrefslogtreecommitdiff
path: root/src/lib.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib.rs')
-rw-r--r--src/lib.rs13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/lib.rs b/src/lib.rs
index 3438749..8aeeb62 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -110,10 +110,19 @@ mod tests {
};
use crate::{Identifiable, NotionApi};
- const TEST_TOKEN: &'static str = include_str!(".api_token");
+ fn test_token() -> String {
+ let token = {
+ if let Some(token) = std::env::var("NOTION_API_TOKEN").ok() {
+ token
+ } else {
+ include_str!(".api_token").to_string()
+ }
+ };
+ token.trim().to_string()
+ }
fn test_client() -> NotionApi {
- NotionApi::new(TEST_TOKEN.trim().to_string()).unwrap()
+ NotionApi::new(test_token()).unwrap()
}
#[tokio::test]