Skip to content

Commit

Permalink
fix(server): startup crash if automate not enable due to missing scop…
Browse files Browse the repository at this point in the history
…e for app (#2415)
  • Loading branch information
fabis94 authored Jun 20, 2024
1 parent 69757fb commit 423e02b
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
10 changes: 8 additions & 2 deletions packages/server/modules/auth/defaultApps.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
import { Scopes } from '@/modules/core/helpers/mainConstants'
import { speckleAutomateUrl, getServerOrigin } from '@/modules/shared/helpers/envHelper'
import {
speckleAutomateUrl,
getServerOrigin,
getFeatureFlags
} from '@/modules/shared/helpers/envHelper'

export enum DefaultAppIds {
Web = 'spklwebapp',
Expand Down Expand Up @@ -123,7 +127,9 @@ const SpeckleAutomate = {
Scopes.Tokens.Write,
Scopes.Streams.Read,
Scopes.Streams.Write,
Scopes.Automate.ReportResults
...(getFeatureFlags().FF_AUTOMATE_MODULE_ENABLED
? [Scopes.Automate.ReportResults]
: [])
]
}

Expand Down
11 changes: 10 additions & 1 deletion packages/server/modules/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,16 @@ const getEnabledModuleNames = () => {
'webhooks'
]

if (FF_AUTOMATE_MODULE_ENABLED) moduleNames.push('automate')
if (FF_AUTOMATE_MODULE_ENABLED) {
// Push in after 'auth', important for scope order?
const authIdx = moduleNames.indexOf('auth')
if (authIdx !== -1) {
moduleNames.splice(authIdx + 1, 0, 'automate')
} else {
moduleNames.push('automate')
}
}

if (FF_GENDOAI_MODULE_ENABLED) moduleNames.push('gendo')
return moduleNames
}
Expand Down

0 comments on commit 423e02b

Please sign in to comment.