hedgedoc/src/utils/test-modes.ts
Erik Michelson 26f90505ff
Adapt react-client to use the real backend API (#1545)
Co-authored-by: Philip Molares <philip.molares@udo.edu>
Co-authored-by: Tilman Vatteroth <git@tilmanvatteroth.de>
2022-04-15 23:03:15 +02:00

23 lines
705 B
TypeScript

/*
* SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
*
* SPDX-License-Identifier: AGPL-3.0-only
*/
import { isPositiveAnswer } from './is-positive-answer'
/**
* Checks if the current runtime is built in e2e test mode.
*/
export const isTestMode = !!process.env.NEXT_PUBLIC_TEST_MODE && isPositiveAnswer(process.env.NEXT_PUBLIC_TEST_MODE)
/**
* Checks if the current runtime should use the mocked backend.
*/
export const isMockMode =
!!process.env.NEXT_PUBLIC_USE_MOCK_API && isPositiveAnswer(process.env.NEXT_PUBLIC_USE_MOCK_API)
/**
* Checks if the current runtime was built in development mode.
*/
export const isDevMode = process.env.NODE_ENV === 'development'