import { Global, Module } from '@nestjs/common';
import { loadConfig, type MosaicConfig } from '@mosaicstack/config';

export const MOSAIC_CONFIG = 'MOSAIC_CONFIG';

@Global()
@Module({
  providers: [
    {
      provide: MOSAIC_CONFIG,
      useFactory: (): MosaicConfig => loadConfig(),
    },
  ],
  exports: [MOSAIC_CONFIG],
})
export class ConfigModule {}
