Fix: Add ui port to template (#1735)

* add ui port to template

* update changelog
This commit is contained in:
Bernd Storath
2025-03-12 13:44:45 +01:00
committed by GitHub
parent fc480df910
commit c3dbd3a815
4 changed files with 17 additions and 1 deletions

View File

@@ -15,4 +15,16 @@ export const OLD_ENV = {
export const WG_ENV = {
/** UI is hosted on HTTP instead of HTTPS */
INSECURE: process.env.INSECURE === 'true',
/** Port the UI is listening on */
PORT: assertEnv('PORT'),
};
function assertEnv<T extends string>(env: T) {
const val = process.env[env];
if (!val) {
throw new Error(`Missing environment variable: ${env}`);
}
return val;
}

View File

@@ -15,6 +15,7 @@ export function template(templ: string, values: Record<string, string>) {
* - ipv6Cidr: IPv6 CIDR
* - device: Network device
* - port: Port number
* - uiPort: UI port number
*/
export function iptablesTemplate(templ: string, wgInterface: InterfaceType) {
return template(templ, {
@@ -22,5 +23,6 @@ export function iptablesTemplate(templ: string, wgInterface: InterfaceType) {
ipv6Cidr: wgInterface.ipv6Cidr,
device: wgInterface.device,
port: wgInterface.port.toString(),
uiPort: WG_ENV.PORT,
});
}