'Angular. Consuming service from module

I have a project with ConfigService which reads values from config.json
Also I use AuthModule from Nebular which configures in module (core.module.ts in my case). One of configuration parameters is backend IP that I already have in config.json.
Is there any way to use ConfigService inside core.module.ts for reading values from config file?

Consuming service from component

Below just an example how I use service inside some component

    private readonly myApiUrl: string = this.configService.getValue['myApiUrl'];
    ...
    constructor(private configService: ConfigService) { }
core.module.ts

(where I'd like to use ConfigService)

    export const NB_CORE_PROVIDERS = [
      ...NbAuthModule.forRoot({

        strategies: [
          NbPasswordAuthStrategy.setup({
            ...
            // baseEndpoint (my backend url, want to use value from config.json here)
            baseEndpoint: 'https://localhost:7250/api',
            ...
          })
          ...
        ],
        ...
      }).providers,
      ...
    ];

    @NgModule({
      imports: [CommonModule],
      exports: [NbAuthModule],
      declarations: [],
    })
    export class CoreModule {
      constructor(@Optional() @SkipSelf() parentModule: CoreModule) {
        throwIfAlreadyLoaded(parentModule, 'CoreModule');
      }

      static forRoot(): ModuleWithProviders<CoreModule> {
        return {
          ngModule: CoreModule,
          providers: [
            ...NB_CORE_PROVIDERS
          ],
        };
      }
    }


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source