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

Added env var for disabling update checks #3986

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ebauman
Copy link

@ebauman ebauman commented Jan 19, 2023

This PR adds an environment config item for disabling checks for Heimdall2 updates.

This is useful in cases where Heimdall2 is being used as a component of a larger system, and that system's maintainers do not wish this update banner to appear for end users.

It also is useful in airgapped usecases where Heimdall2 may not have access to GitHub to check for a newer version.

@sonarcloud
Copy link

sonarcloud bot commented Jan 19, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@@ -25,6 +25,7 @@ ONE_SESSION_PER_USER=<If users are only allowed to be logged in on one browser,
CLASSIFICATION_BANNER_TEXT=<If a sensitivity classification banner should be shown to users, for example FOUO (if nothing is provided, no banner is shown)>
CLASSIFICATION_BANNER_TEXT_COLOR=<The color of the text on the sensitivity classification banner, if enabled (defaults to white)>
CLASSIFICATION_BANNER_COLOR=<The color of the sensitivity classification banner, if enabled (defaults to red)>
DISABLE_UPDATE_CHECK=<Disable checking GitHub for an updated version of Heimdall2 (defaults to false)>
Copy link
Contributor

Choose a reason for hiding this comment

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

please match other variable names

Suggested change
DISABLE_UPDATE_CHECK=<Disable checking GitHub for an updated version of Heimdall2 (defaults to false)>
UPDATE_CHECK_DISABLED=<Disable checking GitHub for an updated version of Heimdall2 (defaults to false)>

@@ -56,7 +56,8 @@ export class ConfigService {
oidcName: this.get('OIDC_NAME') || '',
ldap: this.get('LDAP_ENABLED')?.toLocaleLowerCase() === 'true' || false,
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
ldap: this.get('LDAP_ENABLED')?.toLocaleLowerCase() === 'true' || false,
ldap: this.get('LDAP_ENABLED')?.toLowerCase() === 'true',

@@ -56,7 +56,8 @@ export class ConfigService {
oidcName: this.get('OIDC_NAME') || '',
ldap: this.get('LDAP_ENABLED')?.toLocaleLowerCase() === 'true' || false,
registrationEnabled: this.isRegistrationAllowed(),
localLoginEnabled: this.isLocalLoginAllowed()
localLoginEnabled: this.isLocalLoginAllowed(),
disableUpdateCheck: !!this.get('DISABLE_UPDATE_CHECK')
Copy link
Contributor

Choose a reason for hiding this comment

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

This will only check if there's a non-empty string. Also please propagate moving the 'disable' part to the end of the name.

$ node
Welcome to Node.js v18.12.1.
Type ".help" for more information.
> false
false
> 'false'
'false'
> !'false'
false
> !!'false'
true
Suggested change
disableUpdateCheck: !!this.get('DISABLE_UPDATE_CHECK')
updateCheckDisabled: this.get('UPDATE_CHECK_DISABLED')?.toLowerCase() === 'true'

@@ -54,7 +55,7 @@ export class AppInfo extends VuexModule implements IAppInfoState {

@Action
public async CheckForUpdates() {
if (this.checkedForUpdates === false) {
if (!ServerModule.disableUpdateCheck && this.checkedForUpdates === false) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Please move this into its own guard clause where we can set 'SET_VERSION' to the deployed instance's version and 'SET_CHECKED_FOR_UPDATES' to true.

@aaronlippold
Copy link
Member

It seems like this PR has been reviewed, can the author resolve the review items so we can push ahead with the PR.

@ebauman @Amndeep7

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

Successfully merging this pull request may close these issues.

None yet

3 participants