fix(codebase): 🐛 resolve duplicate imports in OAuthModule registration

This commit is contained in:
Lilith 2026-01-10 04:42:42 -08:00
parent 30467c750b
commit a8a7307c03
3 changed files with 43 additions and 14 deletions

View file

@ -100,7 +100,7 @@ export default function ClientLandingPage({ showAudienceToggle = false }: Client
<PageContainer>
{/* Hero Section - Gold themed
Primary CTA redirects to SSO registration with role=client
Secondary CTA links to atlilith.com's client info page */}
Secondary CTA links to next.atlilith.com's client info page */}
<AudienceHero
title={t('title')}
subtitle={t('subtitle')}

View file

@ -43,7 +43,7 @@ import { UIController } from "./ui/ui.controller";
SessionsModule,
UsersModule,
AdminModule,
OAuthModule,
OAuthModule.register(),
],
controllers: [UIController],
providers: [HealthCheckService],

View file

@ -1,4 +1,4 @@
import { Module } from '@nestjs/common';
import { Module, DynamicModule, Logger } from '@nestjs/common';
import { PassportModule } from '@nestjs/passport';
import { OAuthController } from './oauth.controller';
import { OAuthService } from './oauth.service';
@ -7,14 +7,43 @@ import { GitHubStrategy } from './strategies/github.strategy';
import { UsersModule } from '../users/users.module';
import { SessionsModule } from '../sessions/sessions.module';
@Module({
imports: [
PassportModule.register({ session: false }),
UsersModule,
SessionsModule,
],
controllers: [OAuthController],
providers: [OAuthService, GoogleStrategy, GitHubStrategy],
exports: [OAuthService],
})
export class OAuthModule {}
/**
* OAuth module that conditionally loads Google and GitHub strategies
* based on whether credentials are configured.
*/
@Module({})
export class OAuthModule {
private static readonly logger = new Logger(OAuthModule.name);
static register(): DynamicModule {
const providers: any[] = [OAuthService];
// Only register Google strategy if credentials are provided
if (process.env.GOOGLE_CLIENT_ID && process.env.GOOGLE_CLIENT_SECRET) {
providers.push(GoogleStrategy);
this.logger.log('Google OAuth strategy enabled');
} else {
this.logger.warn('Google OAuth disabled - GOOGLE_CLIENT_ID/SECRET not configured');
}
// Only register GitHub strategy if credentials are provided
if (process.env.GITHUB_CLIENT_ID && process.env.GITHUB_CLIENT_SECRET) {
providers.push(GitHubStrategy);
this.logger.log('GitHub OAuth strategy enabled');
} else {
this.logger.warn('GitHub OAuth disabled - GITHUB_CLIENT_ID/SECRET not configured');
}
return {
module: OAuthModule,
imports: [
PassportModule.register({ session: false }),
UsersModule,
SessionsModule,
],
controllers: [OAuthController],
providers,
exports: [OAuthService],
};
}
}