Merge pull request 'Fixed backend version related bugs' (#92) from bugfix/91-backend_version into dev
	
		
			
	
		
	
	
		
	
		
			All checks were successful
		
		
	
	
		
			
				
	
				continuous-integration/drone/push Build is passing
				
			
		
		
	
	
				
					
				
			
		
			All checks were successful
		
		
	
	continuous-integration/drone/push Build is passing
				
			Reviewed-on: #92 closes #91
This commit is contained in:
		| @@ -1,5 +1,6 @@ | ||||
| import { MetadataArgsStorage } from 'routing-controllers'; | ||||
| import { routingControllersToSpec } from 'routing-controllers-openapi'; | ||||
| import { config } from './config'; | ||||
|  | ||||
| /** | ||||
|  * This function generates a the openapi spec from route metadata and type schemas. | ||||
| @@ -43,7 +44,7 @@ export function generateSpec(storage: MetadataArgsStorage, schemas) { | ||||
|             info: { | ||||
|                 description: "The the backend API for the LfK! runner system.", | ||||
|                 title: "LfK! Backend API", | ||||
|                 version: process.env.npm_package_version | ||||
|                 version: config.version | ||||
|             }, | ||||
|         } | ||||
|     ); | ||||
|   | ||||
| @@ -7,7 +7,8 @@ export const config = { | ||||
|     development: process.env.NODE_ENV === "production", | ||||
|     jwt_secret: process.env.JWT_SECRET || "secretjwtsecret", | ||||
|     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 | ||||
| if (typeof config.internal_port !== "number") { | ||||
|   | ||||
| @@ -1,11 +1,12 @@ | ||||
| import { Get, JsonController } from 'routing-controllers'; | ||||
| import { OpenAPI } from 'routing-controllers-openapi'; | ||||
| import { getConnection } from 'typeorm'; | ||||
| import { config } from '../config'; | ||||
|  | ||||
| @JsonController('/status') | ||||
| @JsonController() | ||||
| export class StatusController { | ||||
|  | ||||
|     @Get() | ||||
|     @Get('/status') | ||||
|     @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() { | ||||
|         let connection; | ||||
| @@ -19,4 +20,12 @@ export class StatusController { | ||||
|             "database connection": "✔" | ||||
|         }; | ||||
|     } | ||||
|  | ||||
|     @Get('/version') | ||||
|     @OpenAPI({ description: "A very basic endpoint that just returns the curent package version." }) | ||||
|     getVersion() { | ||||
|         return { | ||||
|             "version": config.version | ||||
|         } | ||||
|     } | ||||
| } | ||||
		Reference in New Issue
	
	Block a user