Add INIT_ALLOWED_IPS for unattended setup (#2164)

* Add INIT_ALLOWED_IPS env var

Implement INIT_ALLOWED_IPS env var like the INIT_DNS to preset the global Allowed IPs field.

* Docs: Add INIT_ALLOWED_IPS var to unattended setup table

* Make UserConfigService.update param partial

Update UserConfigService.update() to accept any subset of the updatable fields.
Remove the unnecessary userConfig object from  DBService.initialSetup()

* formatting fix

* format on linux

On windows prettier get confused by global conf... common windows things
This commit is contained in:
Németh Bálint
2025-09-16 12:16:31 +02:00
committed by GitHub
parent 8892c43a7d
commit 6c0d8e91fa
4 changed files with 21 additions and 14 deletions
+7 -2
View File
@@ -89,13 +89,18 @@ async function initialSetup(db: DBServiceType) {
if (WG_INITIAL_ENV.DNS) {
DB_DEBUG('Setting initial DNS...');
const userConfig = await db.userConfigs.get();
await db.userConfigs.update({
...userConfig,
defaultDns: WG_INITIAL_ENV.DNS,
});
}
if (WG_INITIAL_ENV.ALLOWED_IPS) {
DB_DEBUG('Setting initial Allowed IPs...');
await db.userConfigs.update({
defaultAllowedIps: WG_INITIAL_ENV.ALLOWED_IPS,
});
}
if (
WG_INITIAL_ENV.USERNAME &&
WG_INITIAL_ENV.PASSWORD &&