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:
@@ -54,7 +54,7 @@ export class UserConfigService {
|
||||
});
|
||||
}
|
||||
|
||||
update(data: UserConfigUpdateType) {
|
||||
update(data: Partial<UserConfigUpdateType>) {
|
||||
return this.#db
|
||||
.update(userConfig)
|
||||
.set(data)
|
||||
|
||||
@@ -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 &&
|
||||
|
||||
Reference in New Issue
Block a user