@@ -26,6 +26,7 @@ export class InitializerService {
26
26
await this . createDefaultResourceOptions ( )
27
27
await this . createDefaultResourceBundles ( )
28
28
await this . createDefaultSettings ( )
29
+ await this . createNecessarySettings ( )
29
30
}
30
31
31
32
async createDefaultRegion ( ) {
@@ -346,32 +347,16 @@ export class InitializerService {
346
347
return
347
348
}
348
349
349
- await this . db . collection < Setting > ( 'Setting' ) . insertOne ( {
350
- public : false ,
351
- key : 'resource_limit' ,
352
- value : 'default' ,
353
- desc : 'resource limit of user' ,
354
- metadata : {
355
- limitOfCPU : 20000 ,
356
- limitOfMemory : 20480 ,
357
- limitCountOfApplication : 20 ,
358
- limitOfDatabaseSyncCount : {
359
- countLimit : 10 ,
360
- timePeriodInSeconds : 86400 ,
361
- } ,
362
- } ,
363
- } )
364
-
365
350
await this . db . collection < Setting > ( 'Setting' ) . insertOne ( {
366
351
public : true ,
367
- key : 'invitation_profit' ,
352
+ key : SettingKey . InvitationProfit ,
368
353
value : '0' ,
369
354
desc : 'Set up invitation rebate' ,
370
355
} )
371
356
372
357
await this . db . collection < Setting > ( 'Setting' ) . insertOne ( {
373
358
public : true ,
374
- key : 'id_verify' ,
359
+ key : SettingKey . IdVerify ,
375
360
value : 'off' , // on | off
376
361
desc : 'real name authentication' ,
377
362
metadata : {
@@ -422,4 +407,28 @@ export class InitializerService {
422
407
423
408
this . logger . verbose ( 'Created default settings' )
424
409
}
410
+
411
+ async createNecessarySettings ( ) {
412
+ const find = await this . db
413
+ . collection < Setting > ( 'Setting' )
414
+ . findOne ( { key : SettingKey . DefaultUserQuota } )
415
+
416
+ if ( ! find ) {
417
+ await this . db . collection < Setting > ( 'Setting' ) . insertOne ( {
418
+ public : false ,
419
+ key : SettingKey . DefaultUserQuota ,
420
+ value : 'default' ,
421
+ desc : 'resource limit of user' ,
422
+ metadata : {
423
+ limitOfCPU : 20000 ,
424
+ limitOfMemory : 20480 ,
425
+ limitCountOfApplication : 20 ,
426
+ limitOfDatabaseSyncCount : {
427
+ countLimit : 10 ,
428
+ timePeriodInSeconds : 86400 ,
429
+ } ,
430
+ } ,
431
+ } )
432
+ }
433
+ }
425
434
}
0 commit comments