drop broken proxy setting and rely on ENV['http_proxy'] instead
fixes #118 fixes #119
This commit is contained in:
@@ -109,10 +109,12 @@ the search view.
|
||||
Configuration is saved to `~/.config/ncspot/config.toml`. Possible configuration
|
||||
values are:
|
||||
|
||||
* `proxy`: Set an HTTP proxy
|
||||
* `use_nerdfont`: Turn nerdfont glyphs on/off <true/false>
|
||||
* `theme`: Set a custom color palette (see below)
|
||||
|
||||
ncspot will respect system proxy settings defined via the `http_proxy`
|
||||
environment variable.
|
||||
|
||||
### Theming
|
||||
|
||||
The color palette can be modified in the configuration. For instance, to have
|
||||
|
||||
@@ -13,7 +13,6 @@ pub struct Config {
|
||||
pub keybindings: Option<HashMap<String, String>>,
|
||||
pub theme: Option<ConfigTheme>,
|
||||
pub use_nerdfont: Option<bool>,
|
||||
pub proxy: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug, Default, Clone)]
|
||||
|
||||
@@ -37,6 +37,7 @@ use tokio_core::reactor::Core;
|
||||
use tokio_timer;
|
||||
use url::Url;
|
||||
|
||||
use std::env;
|
||||
use std::sync::atomic::{AtomicU16, Ordering};
|
||||
use std::sync::RwLock;
|
||||
use std::thread;
|
||||
@@ -246,8 +247,12 @@ impl Spotify {
|
||||
|
||||
pub fn session_config(cfg: &Config) -> SessionConfig {
|
||||
let mut session_config = SessionConfig::default();
|
||||
if let Some(ref proxy) = cfg.proxy {
|
||||
session_config.proxy = Url::parse(&proxy).ok();
|
||||
match env::var("http_proxy") {
|
||||
Ok(proxy) => {
|
||||
info!("Setting HTTP proxy {}", proxy);
|
||||
session_config.proxy = Url::parse(&proxy).ok();
|
||||
}
|
||||
Err(_) => debug!("No HTTP proxy set"),
|
||||
}
|
||||
session_config
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user