feat(server): Add OAuth auto-redirect enable/disable CLI commands (#7841)

* Rebase

* format fix

* docs format

* Change to enable/disable oauth master

* spell change for oauth

* Fix filename
This commit is contained in:
Dhrumil Shah
2024-03-11 23:32:00 -04:00
committed by GitHub
parent d09980f646
commit bbed14a9ff
3 changed files with 56 additions and 1 deletions

View File

@@ -0,0 +1,36 @@
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.');
}
}