From abce82e235364807bf276b9682c303837cef5605 Mon Sep 17 00:00:00 2001 From: Jason Rasmussen Date: Tue, 16 Jan 2024 16:40:09 -0500 Subject: [PATCH] fix(server): enable/disable password login on truenas (#6433) --- server/src/immich-admin/commands/password-login.ts | 3 --- server/src/immich-admin/main.ts | 5 ++++- server/src/immich/controllers/app.controller.ts | 9 +-------- 3 files changed, 5 insertions(+), 12 deletions(-) diff --git a/server/src/immich-admin/commands/password-login.ts b/server/src/immich-admin/commands/password-login.ts index c846ba2f40..e6eea2c725 100644 --- a/server/src/immich-admin/commands/password-login.ts +++ b/server/src/immich-admin/commands/password-login.ts @@ -1,5 +1,4 @@ import { SystemConfigService } from '@app/domain'; -import axios from 'axios'; import { Command, CommandRunner } from 'nest-commander'; @Command({ @@ -15,7 +14,6 @@ export class EnablePasswordLoginCommand extends CommandRunner { const config = await this.configService.getConfig(); config.passwordLogin.enabled = true; await this.configService.updateConfig(config); - await axios.post('http://localhost:3001/api/refresh-config'); console.log('Password login has been enabled.'); } } @@ -33,7 +31,6 @@ export class DisablePasswordLoginCommand extends CommandRunner { const config = await this.configService.getConfig(); config.passwordLogin.enabled = false; await this.configService.updateConfig(config); - await axios.post('http://localhost:3001/api/refresh-config'); console.log('Password login has been disabled.'); } } diff --git a/server/src/immich-admin/main.ts b/server/src/immich-admin/main.ts index 5dc0d5b61e..73ee4ed3f4 100755 --- a/server/src/immich-admin/main.ts +++ b/server/src/immich-admin/main.ts @@ -1,6 +1,9 @@ +import { LogLevel } from '@app/infra/entities'; import { CommandFactory } from 'nest-commander'; import { AppModule } from './app.module'; +process.env.LOG_LEVEL = LogLevel.WARN; + export async function bootstrap() { - await CommandFactory.run(AppModule, ['warn', 'error']); + await CommandFactory.run(AppModule); } diff --git a/server/src/immich/controllers/app.controller.ts b/server/src/immich/controllers/app.controller.ts index bd7c5d4c75..68a61c34c5 100644 --- a/server/src/immich/controllers/app.controller.ts +++ b/server/src/immich/controllers/app.controller.ts @@ -1,5 +1,5 @@ import { SystemConfigService } from '@app/domain'; -import { Controller, Get, Header, HttpCode, HttpStatus, Post } from '@nestjs/common'; +import { Controller, Get, Header } from '@nestjs/common'; import { ApiExcludeEndpoint } from '@nestjs/swagger'; import { PublicRoute } from '../app.guard'; @@ -24,11 +24,4 @@ export class AppController { getCustomCss() { return this.service.getCustomCss(); } - - @ApiExcludeEndpoint() - @Post('refresh-config') - @HttpCode(HttpStatus.OK) - public reloadConfig() { - return this.service.refreshConfig(); - } }