fix override and init option

This commit is contained in:
Bernd Storath
2025-11-17 11:23:51 +01:00
parent 516a3fa72c
commit b29703af86
6 changed files with 50 additions and 66 deletions
+7 -7
View File
@@ -8,13 +8,13 @@ export default defineSetupEventHandler(2, async ({ event }) => {
await Database.users.create(username, password);
// If host and port are overridden by environment variables, skip step 4
const host = WG_CLIENT_OVERRIDE_ENV.HOST;
const port = WG_CLIENT_OVERRIDE_ENV.CLIENT_PORT;
// If host and port are already set by environment variables, skip step 4
const host = WG_INITIAL_ENV.HOST ?? WG_CLIENT_OVERRIDE_ENV.HOST;
const port = WG_INITIAL_ENV.PORT ?? WG_INTERFACE_OVERRIDE_ENV.PORT;
if (host && port) {
// Set the host and port from override variables
await Database.userConfigs.updateHostPort(host, port);
const setupDone = host && port;
if (setupDone) {
// Skip to done
await Database.general.setSetupStep(0);
} else {
@@ -22,5 +22,5 @@ export default defineSetupEventHandler(2, async ({ event }) => {
await Database.general.setSetupStep(3);
}
return { success: true };
return { success: true, setupDone: setupDone };
});