[log]
-filter = "info"
-style = "auto"
+#filter = "info"
+#style = "auto"
[redis]
-#addr = "redis://pokerwave:59f278cd2a96756d67884976f54c1e490d00cb4f7ff62c24a380680e5f5098a3@localhost/0"
+#addr = "redis://localhost"
[server]
-bind = ["localhost:4343"]
-site = "site"
-cert = "cert/cert.pem"
-key = "cert/key.pem"
+#bind = ["localhost:8080"]
+#site = "site"
+#cert = "cert/cert.pem"
+#key = "cert/key.pem"
#[macro_use]
extern crate serde_derive;
+use std::env::set_current_dir;
use std::fs::read_to_string;
use std::future::Future;
+use std::path::Path;
use std::pin::Pin;
use clap::{app_from_crate, crate_authors, crate_description, crate_name, crate_version, AppSettings, Arg, SubCommand};
.get_matches();
let config = match matches.value_of_os("config") {
- Some(path) => toml::from_str(&read_to_string(path)?)?,
+ Some(path) => {
+ let config = toml::from_str(&read_to_string(path)?)?;
+ if let Some(dir) = Path::parent(path.as_ref()) {
+ if !dir.as_os_str().is_empty() {
+ set_current_dir(dir)?;
+ }
+ }
+ config
+ }
None => Config::default(),
};