src/core/app/app.controller.ts
Main application controller
Methods |
| getFrontendConfig |
getFrontendConfig()
|
Decorators :
@Get('frontend-config')
|
|
Defined in src/core/app/app.controller.ts:58
|
|
Returns runtime configuration for the frontend client.
Returns :
FrontendConfigResponseDto
|
| getVersion |
getVersion()
|
Decorators :
@Get('version')
|
|
Defined in src/core/app/app.controller.ts:40
|
|
Returns the running service version. Requires authentication.
Returns :
{ version: any; }
|
| main |
main()
|
Decorators :
@Get()
|
|
Defined in src/core/app/app.controller.ts:24
|
|
Main endpoint providing service info
Returns :
{ service: string; documentation: string; }
|
import { Controller, Get, UseGuards } from "@nestjs/common";
import {
ApiOperation,
ApiResponse,
ApiSecurity,
ApiTags,
} from "@nestjs/swagger";
import { ConfigService } from "@nestjs/config";
import { JwtAuthGuard } from "../../auth/auth.guard";
import { FrontendConfigResponseDto } from "./dto/frontend-config-response.dto";
/**
* Main application controller
*/
@ApiTags("App")
@Controller()
export class AppController {
constructor(private readonly configService: ConfigService) {}
/**
* Main endpoint providing service info
*/
@Get()
main() {
return {
service: "EUDIPLO",
documentation:
"https://openwallet-foundation-labs.github.io/eudiplo/latest/",
};
}
/**
* Returns the running service version. Requires authentication.
*/
@Get("version")
@UseGuards(JwtAuthGuard)
@ApiSecurity("oauth2")
@ApiOperation({ summary: "Get service version" })
@ApiResponse({ status: 200, description: "Service version info" })
getVersion() {
return {
version: process.env.VERSION ?? "main",
};
}
/**
* Returns runtime configuration for the frontend client.
*/
@Get("frontend-config")
@UseGuards(JwtAuthGuard)
@ApiSecurity("oauth2")
@ApiOperation({ summary: "Get frontend runtime configuration" })
@ApiResponse({
status: 200,
description: "Frontend configuration",
type: FrontendConfigResponseDto,
})
getFrontendConfig(): FrontendConfigResponseDto {
const grafanaUrl = this.configService.get<string>("GRAFANA_URL");
return {
grafana: {
url: grafanaUrl || undefined,
tempoUid: this.configService.get<string>(
"GRAFANA_DATASOURCE_TEMPO_UID",
"tempo",
),
lokiUid: this.configService.get<string>(
"GRAFANA_DATASOURCE_LOKI_UID",
"loki",
),
},
};
}
}