env-defined URL for site

This commit is contained in:
emilis 2025-12-02 19:36:05 +00:00
parent 0bd54a517d
commit 6f0a7bf9f4
No known key found for this signature in database
3 changed files with 6 additions and 14 deletions

View File

@ -39,12 +39,7 @@ pub enum ConnectionError {
} }
fn url() -> String { fn url() -> String {
format!( format!("{}/connect/client", crate::clients::BASE_URL)
"{}client",
option_env!("LOCAL")
.map(|_| crate::clients::DEBUG_URL)
.unwrap_or(crate::clients::LIVE_URL)
)
} }
#[derive(Clone)] #[derive(Clone)]

View File

@ -54,12 +54,7 @@ use crate::{
use crate::WerewolfError; use crate::WerewolfError;
fn url() -> String { fn url() -> String {
format!( format!("{}/connect/host", crate::clients::BASE_URL)
"{}host",
option_env!("LOCAL")
.map(|_| crate::clients::DEBUG_URL)
.unwrap_or(crate::clients::LIVE_URL)
)
} }
async fn connect_ws() -> WebSocket { async fn connect_ws() -> WebSocket {

View File

@ -22,5 +22,7 @@ pub mod host {
pub use host::*; pub use host::*;
} }
const DEBUG_URL: &str = "ws://192.168.1.162:8080/connect/"; const BASE_URL: &str = match option_env!("BASE_URL") {
const LIVE_URL: &str = "wss://wolf.emilis.dev/connect/"; Some(base_url) => base_url,
None => "ws://192.168.1.162:8080",
};