mirror of
https://github.com/teloxide/teloxide.git
synced 2025-03-14 11:44:04 +01:00
var_os()
-> var()
(back)
This commit is contained in:
parent
ddefd9e8a6
commit
a326860d4b
1 changed files with 4 additions and 5 deletions
|
@ -20,12 +20,12 @@ impl Bot {
|
|||
///
|
||||
/// [`reqwest::Client`]: https://docs.rs/reqwest/0.10.1/reqwest/struct.Client.html
|
||||
pub fn from_env() -> Arc<Self> {
|
||||
match std::env::var_os("TELOXIDE_PROXY") {
|
||||
match std::env::var("TELOXIDE_PROXY").ok() {
|
||||
Some(proxy) => Self::from_env_with_client(
|
||||
Client::builder()
|
||||
.proxy(
|
||||
reqwest::Proxy::all(
|
||||
&*proxy.to_string_lossy(),
|
||||
&proxy,
|
||||
)
|
||||
.expect("creating reqwest::Proxy"),
|
||||
)
|
||||
|
@ -45,9 +45,8 @@ impl Bot {
|
|||
/// [`reqwest::Client`]: https://docs.rs/reqwest/0.10.1/reqwest/struct.Client.html
|
||||
pub fn from_env_with_client(client: Client) -> Arc<Self> {
|
||||
Self::with_client(
|
||||
&*std::env::var_os("TELOXIDE_TOKEN")
|
||||
.expect("Cannot get the TELOXIDE_TOKEN env variable")
|
||||
.to_string_lossy(),
|
||||
&std::env::var("TELOXIDE_TOKEN")
|
||||
.expect("Cannot get the TELOXIDE_TOKEN env variable"),
|
||||
client,
|
||||
)
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue