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 {
format!(
"{}client",
option_env!("LOCAL")
.map(|_| crate::clients::DEBUG_URL)
.unwrap_or(crate::clients::LIVE_URL)
)
format!("{}/connect/client", crate::clients::BASE_URL)
}
#[derive(Clone)]

View File

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

View File

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