File tree Expand file tree Collapse file tree 1 file changed +10
-6
lines changed Expand file tree Collapse file tree 1 file changed +10
-6
lines changed Original file line number Diff line number Diff line change @@ -49,14 +49,18 @@ async function bootstrap() {
49
49
app . use ( bodyParser . json ( { verify : rawBodyBuffer } ) ) ;
50
50
51
51
const settingService = app . get < SettingService > ( SettingService ) ;
52
- const allowedOrigins = await settingService . getAllowedOrigins ( ) ;
53
52
app . enableCors ( {
54
53
origin : ( origin , callback ) => {
55
- if ( ! origin || allowedOrigins . has ( origin ) ) {
56
- callback ( null , true ) ;
57
- } else {
58
- callback ( new Error ( 'Not allowed by CORS' ) ) ;
59
- }
54
+ settingService
55
+ . getAllowedOrigins ( )
56
+ . then ( ( allowedOrigins ) => {
57
+ if ( ! origin || allowedOrigins . has ( origin ) ) {
58
+ callback ( null , true ) ;
59
+ } else {
60
+ callback ( new Error ( 'Not allowed by CORS' ) ) ;
61
+ }
62
+ } )
63
+ . catch ( callback ) ;
60
64
} ,
61
65
methods : config . security . cors . methods ,
62
66
credentials : config . security . cors . allowCredentials ,
You can’t perform that action at this time.
0 commit comments