Browse Source

Support disabling version check (#2648)

* Support disabling version check

* Update docs

* Move the bypass logic back to update checking function

* fix linting

* fix linting (again)
master
minhducsun2002 1 day ago
committed by GitHub
parent
commit
d0566a1df9
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 13
      docs/content/advanced/config/optional-config.md
  2. 1
      src/server/utils/config.ts
  3. 7
      src/server/utils/release.ts

13
docs/content/advanced/config/optional-config.md

@ -4,12 +4,13 @@ title: Optional Configuration
You can set these environment variables to configure the container. They are not required, but can be useful in some cases. You can set these environment variables to configure the container. They are not required, but can be useful in some cases.
| Env | Default | Example | Description | | Env | Default | Example | Description |
| -------------- | --------- | ----------- | ---------------------------------- | | ----------------------- | --------- | ----------- | --------------------------------------- |
| `PORT` | `51821` | `6789` | TCP port for Web UI. | | `PORT` | `51821` | `6789` | TCP port for Web UI. |
| `HOST` | `0.0.0.0` | `localhost` | IP address web UI binds to. | | `HOST` | `0.0.0.0` | `localhost` | IP address web UI binds to. |
| `INSECURE` | `false` | `true` | If access over http is allowed | | `INSECURE` | `false` | `true` | If access over http is allowed |
| `DISABLE_IPV6` | `false` | `true` | If IPv6 support should be disabled | | `DISABLE_IPV6` | `false` | `true` | If IPv6 support should be disabled |
| `DISABLE_VERSION_CHECK` | `false` | `true` | If wg-easy should check for new updates |
/// note | IPv6 Caveats /// note | IPv6 Caveats

1
src/server/utils/config.ts

@ -38,6 +38,7 @@ export const WG_ENV = {
/** If IPv6 should be disabled */ /** If IPv6 should be disabled */
DISABLE_IPV6: process.env.DISABLE_IPV6 === 'true', DISABLE_IPV6: process.env.DISABLE_IPV6 === 'true',
WG_EXECUTABLE: await detectAwg(), WG_EXECUTABLE: await detectAwg(),
DISABLE_VERSION_CHECK: process.env.DISABLE_VERSION_CHECK === 'true',
}; };
export const WG_INITIAL_ENV = { export const WG_INITIAL_ENV = {

7
src/server/utils/release.ts

@ -4,6 +4,13 @@ type GithubRelease = {
}; };
async function fetchLatestRelease() { async function fetchLatestRelease() {
if (WG_ENV.DISABLE_VERSION_CHECK) {
return {
version: RELEASE,
changelog: '',
};
}
try { try {
const response = await $fetch<GithubRelease>( const response = await $fetch<GithubRelease>(
'https://api.github.com/repos/wg-easy/wg-easy/releases/latest', 'https://api.github.com/repos/wg-easy/wg-easy/releases/latest',

Loading…
Cancel
Save