Browse Source

fix: load config from appInitService

Signed-off-by: Pranav C <pranavxc@gmail.com>
pull/5680/head
Pranav C 2 years ago
parent
commit
69d74be3d1
  1. 7
      packages/nocodb/src/modules/global/global.module.ts
  2. 22
      packages/nocodb/src/services/app-init.service.ts

7
packages/nocodb/src/modules/global/global.module.ts

@ -15,8 +15,11 @@ import type { Provider } from '@nestjs/common';
export const JwtStrategyProvider: Provider = {
provide: JwtStrategy,
useFactory: async (usersService: UsersService) => {
const config = Noco.config;
useFactory: async (
usersService: UsersService,
appInitService: AppInitService,
) => {
const config = appInitService.appConfig;
await Noco.initJwt();

22
packages/nocodb/src/services/app-init.service.ts

@ -9,11 +9,27 @@ import NcUpgrader from '../version-upgrader/NcUpgrader';
import type { IEventEmitter } from '../modules/event-emitter/event-emitter.interface';
import type { Provider } from '@nestjs/common';
@Injectable()
export class AppInitService {}
export class AppInitService {
private readonly config: any;
constructor(config) {
this.config = config;
}
get appConfig(): any {
return this.config;
}
}
export const appInitServiceProvider: Provider = {
provide: AppInitService,
// initialize app,
// 1. init cache
// 2. init db connection and create if not exist
// 3. init meta and set to Noco
// 4. init jwt
// 5. init plugin manager
// 6. run upgrader
useFactory: async (
connection: Connection,
metaService: MetaService,
@ -46,7 +62,7 @@ export const appInitServiceProvider: Provider = {
await NcUpgrader.upgrade({ ncMeta: Noco._ncMeta });
// todo: move app config to app-init service
return new AppInitService();
return new AppInitService(connection.config);
},
inject: [Connection, MetaService, 'IEventEmitter'],
};

Loading…
Cancel
Save