Browse Source

refactor: change env values

pull/2102/head
cany748 1 month ago
parent
commit
2dad691124
  1. 9
      src/server/utils/config.ts
  2. 2
      src/server/utils/wgHelper.ts

9
src/server/utils/config.ts

@ -12,6 +12,8 @@ export const OLD_ENV = {
PASSWORD_HASH: process.env.PASSWORD_HASH,
};
const OVERRIDE_AUTO_AWG = process.env.OVERRIDE_AUTO_AWG?.toLowerCase();
export const WG_ENV = {
/** UI is hosted on HTTP instead of HTTPS */
INSECURE: process.env.INSECURE === 'true',
@ -21,10 +23,9 @@ export const WG_ENV = {
DISABLE_IPV6: process.env.DISABLE_IPV6 === 'true',
/** Override automatic detection */
OVERRIDE_AUTO_AWG:
process.env.OVERRIDE_AUTO_AWG === 'true'
? true
: process.env.OVERRIDE_AUTO_AWG === 'false'
? false
OVERRIDE_AUTO_AWG === ('wg' as const) ||
OVERRIDE_AUTO_AWG === ('awg' as const)
? OVERRIDE_AUTO_AWG
: undefined,
/** TODO: delete on next major version */
EXPERIMENTAL_AWG: process.env.EXPERIMENTAL_AWG === 'true',

2
src/server/utils/wgHelper.ts

@ -13,7 +13,7 @@ let wgExecutable: 'awg' | 'wg' = 'wg';
if (WG_ENV.EXPERIMENTAL_AWG) {
if (WG_ENV.OVERRIDE_AUTO_AWG !== undefined) {
wgExecutable = WG_ENV.OVERRIDE_AUTO_AWG ? 'awg' : 'wg';
wgExecutable = WG_ENV.OVERRIDE_AUTO_AWG;
} else {
wgExecutable = await exec('modinfo amneziawg')
.then(() => 'awg' as const)

Loading…
Cancel
Save