mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-15 23:54:42 -04:00
Refactor handling of environment variables (#2303)
* Refactor environment variables Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de>
This commit is contained in:
parent
e412115a78
commit
39a4125cb0
85 changed files with 624 additions and 461 deletions
|
@ -5,6 +5,7 @@
|
|||
*/
|
||||
|
||||
import type { NextApiRequest, NextApiResponse } from 'next'
|
||||
import { isMockMode } from '../utils/test-modes'
|
||||
|
||||
export enum HttpMethod {
|
||||
GET = 'GET',
|
||||
|
@ -31,6 +32,10 @@ export const respondToMatchingRequest = <T>(
|
|||
response: T,
|
||||
statusCode = 200
|
||||
): boolean => {
|
||||
if (!isMockMode) {
|
||||
res.status(404).send('Mock API is disabled')
|
||||
return false
|
||||
}
|
||||
if (method !== req.method) {
|
||||
res.status(405).send('Method not allowed')
|
||||
return false
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue