mirror of
https://github.com/nowcommunity/nowdatabase.git
synced 2026-10-12 19:13:52 +03:00
Add enable write env to frontend and rename envs common to front and back with VITE_, so that same env works for both
This commit is contained in:
@@ -17,6 +17,5 @@ LOG_DB_NAME: now_log_test
|
||||
|
||||
COORDINATOR: TEST-SU
|
||||
|
||||
ENABLE_WRITE: true
|
||||
RUNNING_ENV: dev
|
||||
VITE_ENABLE_WRITE: true
|
||||
VITE_RUNNING_ENV: dev
|
||||
|
||||
@@ -12,11 +12,11 @@ export const USER_CREATION_SECRET = process.env.USER_CREATION_SECRET as string
|
||||
prod = production with real data
|
||||
*/
|
||||
const allowedRunningEnvs = ['dev', 'staging', 'prod'] as const
|
||||
export const RUNNING_ENV = process.env.RUNNING_ENV as (typeof allowedRunningEnvs)[number]
|
||||
export const RUNNING_ENV = process.env.VITE_RUNNING_ENV as (typeof allowedRunningEnvs)[number]
|
||||
if (!allowedRunningEnvs.includes(RUNNING_ENV)) throw new Error('Invalid RUNNING_ENV')
|
||||
|
||||
// Enable write operations. If this is not set to 'true', all write (create, update, delete) operations except for allowed ones (like user/login) are disabled.
|
||||
export const ENABLE_WRITE = process.env.ENABLE_WRITE === 'true'
|
||||
export const ENABLE_WRITE = process.env.VITE_ENABLE_WRITE === 'true'
|
||||
|
||||
export const DB_CONNECTION_LIMIT = (process.env.DB_CONNECTION_LIMIT as string) ?? '10'
|
||||
export const NOW_DB_NAME = process.env.NOW_DB_NAME as string
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
export const BACKEND_URL = (import.meta.env.VITE_BACKEND_URL as string | undefined) ?? 'http://localhost:4000/'
|
||||
export const ENV = import.meta.env.VITE_RUNNING_ENV as 'dev' | 'staging' | 'prod'
|
||||
export const ENABLE_WRITE = import.meta.env.ENABLE_WRITE === 'true'
|
||||
export const ENABLE_WRITE = import.meta.env.VITE_ENABLE_WRITE === 'true'
|
||||
|
||||
Reference in New Issue
Block a user