hit-sms-api/src/hub/hub.controller.ts

25 lines
784 B
TypeScript

import { Controller, Get, InternalServerErrorException, Logger, UseGuards } from '@nestjs/common'
import { HubService } from './hub.service'
import { ApiKeyGuard } from 'src/guards/api-key.guard'
@Controller('hub')
@UseGuards(ApiKeyGuard)
export class HubController {
constructor (private readonly hubService: HubService) { }
@Get('/config')
async findHitphoneDesktopServerConfig () {
try {
const hitphoneDesktopServerConfig = await this.hubService.findHitphoneDesktopServerConfig()
return {
...hitphoneDesktopServerConfig
}
} catch (error) {
Logger.error(`Error reading certificate or key file: ${error.message}`)
throw new InternalServerErrorException({
message: 'Error reading config informations'
})
}
}
}