Compare commits

..

No commits in common. "cf788fe07bab506efb3744afa2e4add1cde7d0d6" and "234154255cf55638f905ee8e39ca207f406f9ee0" have entirely different histories.

3 changed files with 4 additions and 15 deletions

View File

@ -1,6 +1,5 @@
import { MetadataArgsStorage } from 'routing-controllers'; import { MetadataArgsStorage } from 'routing-controllers';
import { routingControllersToSpec } from 'routing-controllers-openapi'; import { routingControllersToSpec } from 'routing-controllers-openapi';
import { config } from './config';
/** /**
* This function generates a the openapi spec from route metadata and type schemas. * This function generates a the openapi spec from route metadata and type schemas.
@ -44,7 +43,7 @@ export function generateSpec(storage: MetadataArgsStorage, schemas) {
info: { info: {
description: "The the backend API for the LfK! runner system.", description: "The the backend API for the LfK! runner system.",
title: "LfK! Backend API", title: "LfK! Backend API",
version: config.version version: process.env.npm_package_version
}, },
} }
); );

View File

@ -7,8 +7,7 @@ export const config = {
development: process.env.NODE_ENV === "production", development: process.env.NODE_ENV === "production",
jwt_secret: process.env.JWT_SECRET || "secretjwtsecret", jwt_secret: process.env.JWT_SECRET || "secretjwtsecret",
phone_validation_countrycode: process.env.PHONE_COUNTRYCODE || "ZZ", phone_validation_countrycode: process.env.PHONE_COUNTRYCODE || "ZZ",
postalcode_validation_countrycode: getPostalCodeLocale(), postalcode_validation_countrycode: getPostalCodeLocale()
version: process.env.VERSION || require('../package.json').version
} }
let errors = 0 let errors = 0
if (typeof config.internal_port !== "number") { if (typeof config.internal_port !== "number") {

View File

@ -1,12 +1,11 @@
import { Get, JsonController } from 'routing-controllers'; import { Get, JsonController } from 'routing-controllers';
import { OpenAPI } from 'routing-controllers-openapi'; import { OpenAPI } from 'routing-controllers-openapi';
import { getConnection } from 'typeorm'; import { getConnection } from 'typeorm';
import { config } from '../config';
@JsonController() @JsonController('/status')
export class StatusController { export class StatusController {
@Get('/status') @Get()
@OpenAPI({ description: "A very basic status/health endpoint that just checks if the database connection is available. <br> The available information depth will be expanded later." }) @OpenAPI({ description: "A very basic status/health endpoint that just checks if the database connection is available. <br> The available information depth will be expanded later." })
get() { get() {
let connection; let connection;
@ -20,12 +19,4 @@ export class StatusController {
"database connection": "✔" "database connection": "✔"
}; };
} }
@Get('/version')
@OpenAPI({ description: "A very basic endpoint that just returns the curent package version." })
getVersion() {
return {
"version": config.version
}
}
} }