frontend: use TRUNK_PUBLIC_URL

This commit is contained in:
Dmitry Belyaev 2025-03-26 12:11:48 +03:00
parent 807ead7dc7
commit 4d8c4d502b
Signed by: b4tman
GPG Key ID: 41A00BF15EA7E5F3
2 changed files with 11 additions and 3 deletions

@ -5,6 +5,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Peazyweb - OpenVPN config creator</title>
<script src="https://cdn.tailwindcss.com"></script>
<base data-trunk-public-url />
</head>
<body class="bg-gradient-to-r from-[#f0f9ff] to-[#e6f3ff]">
<div id="app"></div>
@ -13,4 +14,4 @@
init();
</script>
</body>
</html>
</html>

@ -37,8 +37,15 @@ pub enum Route {
}
lazy_static! {
static ref API_BASE_URL: String =
std::env::var("API_BASE_URL").unwrap_or("http://127.0.0.1:8000/api/v1".into());
static ref API_BASE_URL: String = option_env!("API_BASE_URL")
.unwrap_or(
(option_env!("TRUNK_PUBLIC_URL")
.unwrap_or("http://127.0.0.1:8000/")
.to_string()
+ "api/v1")
.as_str(),
)
.to_owned();
}
pub struct APIEndpoints {}