mirror of https://github.com/wg-easy/wg-easy
Browse Source
- GET endpoints now return raw database values (not overridden values) - Created /api/admin/overrides route that returns which fields are overridden by env vars - Removed comments from POST endpoints - Admin panel can now show database values and display indicators for overridden fields Co-authored-by: kaaax0815 <[email protected]>copilot/add-env-variables-admin-panel
8 changed files with 27 additions and 18 deletions
@ -1,5 +1,4 @@ |
|||
export default definePermissionEventHandler('admin', 'any', async () => { |
|||
const generalConfig = await Database.general.getConfig(); |
|||
const generalConfigWithOverrides = applyGeneralOverrides(generalConfig); |
|||
return generalConfigWithOverrides; |
|||
return generalConfig; |
|||
}); |
|||
|
|||
@ -1,9 +1,8 @@ |
|||
export default definePermissionEventHandler('admin', 'any', async () => { |
|||
const wgInterface = await Database.interfaces.get(); |
|||
const wgInterfaceWithOverrides = applyInterfaceOverrides(wgInterface); |
|||
|
|||
return { |
|||
...wgInterfaceWithOverrides, |
|||
...wgInterface, |
|||
privateKey: undefined, |
|||
}; |
|||
}); |
|||
|
|||
@ -0,0 +1,24 @@ |
|||
export default definePermissionEventHandler('admin', 'any', async () => { |
|||
return { |
|||
interface: { |
|||
port: WG_OVERRIDE_ENV.PORT !== undefined, |
|||
device: WG_OVERRIDE_ENV.DEVICE !== undefined, |
|||
mtu: WG_OVERRIDE_ENV.MTU !== undefined, |
|||
ipv4Cidr: WG_OVERRIDE_ENV.IPV4_CIDR !== undefined, |
|||
ipv6Cidr: WG_OVERRIDE_ENV.IPV6_CIDR !== undefined, |
|||
}, |
|||
userConfig: { |
|||
host: WG_CLIENT_OVERRIDE_ENV.HOST !== undefined, |
|||
port: WG_CLIENT_OVERRIDE_ENV.CLIENT_PORT !== undefined, |
|||
defaultDns: WG_CLIENT_OVERRIDE_ENV.DEFAULT_DNS !== undefined, |
|||
defaultAllowedIps: WG_CLIENT_OVERRIDE_ENV.DEFAULT_ALLOWED_IPS !== undefined, |
|||
defaultMtu: WG_CLIENT_OVERRIDE_ENV.DEFAULT_MTU !== undefined, |
|||
defaultPersistentKeepalive: WG_CLIENT_OVERRIDE_ENV.DEFAULT_PERSISTENT_KEEPALIVE !== undefined, |
|||
}, |
|||
general: { |
|||
sessionTimeout: WG_GENERAL_OVERRIDE_ENV.SESSION_TIMEOUT !== undefined, |
|||
metricsPrometheus: WG_GENERAL_OVERRIDE_ENV.METRICS_PROMETHEUS !== undefined, |
|||
metricsJson: WG_GENERAL_OVERRIDE_ENV.METRICS_JSON !== undefined, |
|||
}, |
|||
}; |
|||
}); |
|||
@ -1,5 +1,4 @@ |
|||
export default definePermissionEventHandler('admin', 'any', async () => { |
|||
const userConfig = await Database.userConfigs.get(); |
|||
const userConfigWithOverrides = applyUserConfigOverrides(userConfig); |
|||
return userConfigWithOverrides; |
|||
return userConfig; |
|||
}); |
|||
|
|||
Loading…
Reference in new issue