Skip to content

Commit

Permalink
pg_port is now default if ELECTRIC_TAURI_PG_PORT is not set
Browse files Browse the repository at this point in the history
  • Loading branch information
tachyonicbytes committed Jan 30, 2024
1 parent 5199ca7 commit cfb3958
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions examples/tauri-postgres/src-tauri/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -464,10 +464,10 @@ fn extract_ollama_port(line: String) -> Option<String> {
}

fn main() {
// pg_port is either ELECTRIC_TAURI_PG_PORT, either the first argument, or the DEFAULT_PG_PORT(33333)
// pg_port is either ELECTRIC_TAURI_PG_PORT, or the one chosen by portpicker (race conditions possible)
let pg_port = match env::var("ELECTRIC_TAURI_PG_PORT") {
Ok(value) => value.parse::<u16>().unwrap(),
Err(_) => DEFAULT_PG_PORT,
Err(_) => portpicker::pick_unused_port().unwrap(),
};

info!("pg_port is: {}", pg_port);
Expand Down

0 comments on commit cfb3958

Please sign in to comment.