import { Module } from '@nestjs/common';

import { getApiPersistence } from '../../env';
import { InMemoryIdentityPersistenceModule } from '../inmemory/InMemoryIdentityPersistenceModule';
import { PostgresIdentityPersistenceModule } from '../postgres/PostgresIdentityPersistenceModule';

const selectedPersistenceModule =
  getApiPersistence() === 'postgres' ? PostgresIdentityPersistenceModule : InMemoryIdentityPersistenceModule;

@Module({
  imports: [selectedPersistenceModule],
  exports: [selectedPersistenceModule],
})
export class IdentityPersistenceModule {}