Refactor client config (#529)

* Refactor client config

* Fix server tests

* Fix lint
This commit is contained in:
Charles Bochet
2023-07-07 11:10:42 -07:00
committed by GitHub
parent 11d18cc269
commit 26b033abc9
38 changed files with 386 additions and 180 deletions

View File

@ -0,0 +1,28 @@
import { Resolver, Query } from '@nestjs/graphql';
import { EnvironmentService } from 'src/integrations/environment/environment.service';
import { ClientConfig } from './client-config.entity';
@Resolver()
export class ClientConfigResolver {
constructor(private environmentService: EnvironmentService) {}
@Query(() => ClientConfig)
async clientConfig(): Promise<ClientConfig> {
const clientConfig: ClientConfig = {
authProviders: {
google: this.environmentService.isAuthGoogleEnabled() ?? false,
magicLink: false,
password: true,
},
telemetry: {
enabled: this.environmentService.isTelemetryEnabled() ?? false,
anonymizationEnabled:
this.environmentService.isTelemetryAnonymizationEnabled() ?? false,
},
demoMode: this.environmentService.isDemoMode() ?? false,
debugMode: this.environmentService.isDebugMode() ?? false,
};
return Promise.resolve(clientConfig);
}
}