make config in exe name has highest priority, also overwrite config if

installation,
https://github.com/rustdesk/rustdesk-server-pro/issues/21#issuecomment-1638259580,
not tested yet
This commit is contained in:
rustdesk
2023-07-19 14:45:11 +08:00
parent b40c3aae52
commit aacffd979b
6 changed files with 35 additions and 84 deletions

View File

@@ -49,6 +49,7 @@ lazy_static::lazy_static! {
Some(key) if !key.is_empty() => key,
_ => "",
}.to_owned()));
pub static ref EXE_RENDEZVOUS_SERVER: Arc<RwLock<String>> = Default::default();
pub static ref APP_NAME: Arc<RwLock<String>> = Arc::new(RwLock::new("RustDesk".to_owned()));
static ref KEY_PAIR: Arc<Mutex<Option<KeyPair>>> = Default::default();
static ref HW_CODEC_CONFIG: Arc<RwLock<HwCodecConfig>> = Arc::new(RwLock::new(HwCodecConfig::load()));
@@ -604,7 +605,10 @@ impl Config {
}
pub fn get_rendezvous_server() -> String {
let mut rendezvous_server = Self::get_option("custom-rendezvous-server");
let mut rendezvous_server = EXE_RENDEZVOUS_SERVER.read().unwrap().clone();
if rendezvous_server.is_empty() {
rendezvous_server = Self::get_option("custom-rendezvous-server");
}
if rendezvous_server.is_empty() {
rendezvous_server = PROD_RENDEZVOUS_SERVER.read().unwrap().clone();
}
@@ -624,6 +628,10 @@ impl Config {
}
pub fn get_rendezvous_servers() -> Vec<String> {
let s = EXE_RENDEZVOUS_SERVER.read().unwrap().clone();
if !s.is_empty() {
return vec![s];
}
let s = Self::get_option("custom-rendezvous-server");
if !s.is_empty() {
return vec![s];