Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(config): Add missing environment variable for devOptions.skipUpdateCheck parameter #1018

Merged
merged 1 commit into from
Jun 21, 2024

Conversation

wmedlar
Copy link
Contributor

@wmedlar wmedlar commented Jun 15, 2024

This change adds a missing environment variable for the devOptions.skipUpdateCheck boolean parameter — DEV_OPTIONS_SKIP_UPDATE_CHECK. This option defaults to false, running the update check at boot.

Skipping the update check marginally reduces boot time and prevents a warning message when git is not installed (such as in a minimal container image).

Below is a brief demonstration of the change on a system that does have git installed:

  • DEV_OPTIONS_SKIP_UPDATE_CHECK not set
$ npm run server

> [email protected] server
> node server/src/index.js

[ ... ]
ℹ 2024-06-15 21:14:32 [API] Loaded users.js
ℹ 2024-06-15 21:14:32 [UPDATE] There is a new version available:   git pull  to update
ℹ 2024-06-15 21:14:32 [UPDATE] Completed
ℹ 2024-06-15 21:14:33 [DB] Determining database types for 2 connections
[ ... ]
  • DEV_OPTIONS_SKIP_UPDATE_CHECK set to true
$ DEV_OPTIONS_SKIP_UPDATE_CHECK=true npm run server 

> [email protected] server
> node server/src/index.js

[...]
ℹ 2024-06-15 21:14:52 [API] Loaded users.js
ℹ 2024-06-15 21:14:54 [DB] Determining database types for 2 connections
[...]
  • DEV_OPTIONS_SKIP_UPDATE_CHECK set to false
$ DEV_OPTIONS_SKIP_UPDATE_CHECK=false npm run server

> [email protected] server
> node server/src/index.js

[...]
ℹ 2024-06-15 21:15:32 [API] Loaded users.js
ℹ 2024-06-15 21:15:32 [UPDATE] There is a new version available:   git pull  to update
ℹ 2024-06-15 21:15:32 [UPDATE] Completed
ℹ 2024-06-15 21:15:33 [DB] Determining database types for 2 connections
[...]
  • devOptions.skipUpdateCheck is not present in the server config file.
index 4dc24f09..3d9960bd 100644
--- a/server/src/configs/default.json
+++ b/server/src/configs/default.json
@@ -8,8 +8,7 @@
     "graphiql": false,
     "queryDebug": false,
     "logLevel": "info",
-    "skipMinified": false,
-    "skipUpdateCheck": false
+    "skipMinified": false
   },
   "api": {
$ npm run server                                    

> [email protected] server
> node server/src/index.js

[ ... ]
ℹ 2024-06-15 21:25:44 [API] Loaded users.js
ℹ 2024-06-15 21:25:45 [UPDATE] There is a new version available:   git pull  to update
ℹ 2024-06-15 21:25:45 [UPDATE] Completed
ℹ 2024-06-15 21:25:45 [DB] Determining database types for 2 connections
[ ... ]

@wmedlar wmedlar force-pushed the wm/skip-update-check branch 2 times, most recently from 7320e43 to 63b0297 Compare June 15, 2024 21:25
Copy link
Collaborator

@TurtIeSocks TurtIeSocks left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the contribution, though this was intentionally left out of the config. Please change the target branch to develop and clean up the one comment I left then it'll be good to go.

const skipUpdateCheck = config.has('devOptions.skipUpdateCheck')
? config.getSafe('devOptions.skipUpdateCheck')
: false
if (!skipUpdateCheck) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (!skipUpdateCheck) {
if (!config.getSafe('devOptions.skipUpdateCheck')) {

The only reason the has is being called was because this value often didn't exist in the config. Now that it's in default.json, you don't need it and you can just check the value right in the if statement.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated, rebased, and retargeted to develop 👍

@wmedlar wmedlar changed the base branch from main to develop June 20, 2024 18:20
@wmedlar wmedlar force-pushed the wm/skip-update-check branch from 63b0297 to 14eca4c Compare June 21, 2024 21:38
@wmedlar wmedlar requested a review from TurtIeSocks June 21, 2024 21:39
@TurtIeSocks TurtIeSocks merged commit 239d02d into WatWowMap:develop Jun 21, 2024
2 checks passed
@wmedlar wmedlar deleted the wm/skip-update-check branch June 21, 2024 21:42
Copy link

🎉 This PR is included in version 1.33.0-develop.9 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants