use different ports for dev and live modes

This commit is contained in:
Joseph Montanaro 2022-12-21 16:22:24 -08:00
parent bf4c46238e
commit 398916fe10
2 changed files with 12 additions and 4 deletions

View File

@ -10,10 +10,17 @@ pub struct AppConfig {
impl Default for AppConfig { impl Default for AppConfig {
fn default() -> Self { fn default() -> Self {
let listen_port = if cfg!(debug_assertions) {
12_345
}
else {
19_923
};
AppConfig { AppConfig {
db_path: get_or_create_db_path(), db_path: get_or_create_db_path(),
listen_addr: Ipv4Addr::LOCALHOST, listen_addr: Ipv4Addr::LOCALHOST,
listen_port: 19_923 listen_port,
} }
} }
} }
@ -31,7 +38,7 @@ fn get_or_create_db_path() -> PathBuf {
p p
}) })
.unwrap_or(PathBuf::from(".")); .unwrap_or(PathBuf::from("."));
parent.push("creddy.db");
parent.push("creddy.db");
parent parent
} }

View File

@ -29,7 +29,7 @@
"icons/icon.icns", "icons/icon.icns",
"icons/icon.ico" "icons/icon.ico"
], ],
"identifier": "com.tauri.dev", "identifier": "creddy",
"longDescription": "", "longDescription": "",
"macOS": { "macOS": {
"entitlements": null, "entitlements": null,
@ -60,7 +60,8 @@
"resizable": true, "resizable": true,
"label": "main", "label": "main",
"title": "Creddy", "title": "Creddy",
"width": 800 "width": 800,
"visible": false
} }
], ],
"systemTray": { "systemTray": {