Load API ID and hash from env
This commit is contained in:
parent
a341466749
commit
0f412f7334
|
@ -25,8 +25,21 @@ type Result<T> = std::result::Result<T, Box<dyn std::error::Error>>;
|
||||||
|
|
||||||
const LOG_MIN_LEVEL: Level = Level::Trace;
|
const LOG_MIN_LEVEL: Level = Level::Trace;
|
||||||
const LOG_TAG: &str = ".native.talari";
|
const LOG_TAG: &str = ".native.talari";
|
||||||
const API_ID: i32 = 0;
|
const API_ID: i32 = {
|
||||||
const API_HASH: &str = "";
|
let mut index = 0;
|
||||||
|
let mut value = 0;
|
||||||
|
let api_id = env!("TALARIA_API_ID");
|
||||||
|
let bytes = api_id.as_bytes();
|
||||||
|
while index < bytes.len() {
|
||||||
|
match bytes[index] {
|
||||||
|
b @ b'0'..=b'9' => value = value * 10 + (b - b'0') as i32,
|
||||||
|
_ => panic!("non-digit character found in API ID"),
|
||||||
|
}
|
||||||
|
index += 1
|
||||||
|
}
|
||||||
|
value
|
||||||
|
};
|
||||||
|
const API_HASH: &str = env!("TALARIA_API_HASH");
|
||||||
|
|
||||||
static RUNTIME: OnceCell<Runtime> = OnceCell::new();
|
static RUNTIME: OnceCell<Runtime> = OnceCell::new();
|
||||||
static CLIENT: OnceCell<Client> = OnceCell::new();
|
static CLIENT: OnceCell<Client> = OnceCell::new();
|
||||||
|
|
Loading…
Reference in New Issue