mirror of
https://github.com/immich-app/immich.git
synced 2025-12-19 09:13:14 +03:00
37 lines
997 B
TypeScript
37 lines
997 B
TypeScript
|
|
import { SystemConfigService } from '@app/domain';
|
||
|
|
import { Command, CommandRunner } from 'nest-commander';
|
||
|
|
|
||
|
|
@Command({
|
||
|
|
name: 'enable-oauth-login',
|
||
|
|
description: 'Enable OAuth login',
|
||
|
|
})
|
||
|
|
export class EnableOAuthLogin extends CommandRunner {
|
||
|
|
constructor(private configService: SystemConfigService) {
|
||
|
|
super();
|
||
|
|
}
|
||
|
|
|
||
|
|
async run(): Promise<void> {
|
||
|
|
const config = await this.configService.getConfig();
|
||
|
|
config.oauth.enabled = true;
|
||
|
|
await this.configService.updateConfig(config);
|
||
|
|
console.log('OAuth login has been enabled.');
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
@Command({
|
||
|
|
name: 'disable-oauth-login',
|
||
|
|
description: 'Disable OAuth login',
|
||
|
|
})
|
||
|
|
export class DisableOAuthLogin extends CommandRunner {
|
||
|
|
constructor(private configService: SystemConfigService) {
|
||
|
|
super();
|
||
|
|
}
|
||
|
|
|
||
|
|
async run(): Promise<void> {
|
||
|
|
const config = await this.configService.getConfig();
|
||
|
|
config.oauth.enabled = false;
|
||
|
|
await this.configService.updateConfig(config);
|
||
|
|
console.log('OAuth login has been disabled.');
|
||
|
|
}
|
||
|
|
}
|