fix: allow server address as url without path

This commit is contained in:
Julian Krauser 2025-01-06 16:10:47 +01:00
parent f74c10d4aa
commit 2176c6c3cf
3 changed files with 4 additions and 4 deletions

View file

@ -1,4 +1,4 @@
VITE_SERVER_ADDRESS = serveradress #ohne https und ohne pfad
VITE_SERVER_ADDRESS = backend_url #ohne pfad
VITE_IMPRINT_LINK = https://mywebsite-imprint-url
VITE_PRIVACY_LINK = https://mywebsite-privacy-url
VITE_CUSTOM_LOGIN_MESSAGE = betrieben von xy

View file

@ -31,7 +31,7 @@ services:
restart: unless-stopped
#environment:
# - SERVERADRESS=<backend_host> # wichtig: ohne https:// bzw http:// und ohne pfad
# - SERVERADDRESS=<backend_url (https://... | http://...)> # wichtig: ohne pfad
# - IMPRINTLINK=https://mywebsite-imprint-url
# - PRIVACYLINK=https://mywebsite-privacy-url
# - CUSTOMLOGINMESSAGE=betrieben von xy

View file

@ -7,8 +7,8 @@ import { config } from "./config";
let devMode = process.env.NODE_ENV === "development";
let host = devMode ? "localhost:5000" : (config.server_address ?? "");
let url = devMode ? "http://" + host : (host ? "https://" : "") + host;
let host = devMode ? "localhost:5000" : (config.server_address ?? "").replace(/(^\w+:|^)\/\//, "");
let url = devMode ? "http://" + host : config.server_address;
const http = axios.create({
baseURL: url + "/api",