Ver Fonte

introduce FORCE_MAINTENANCE variable (#4297)

Bartosz Dryl há 1 ano atrás
pai
commit
316f10b0ab

+ 2 - 0
packages/atlas/src/.env

@@ -5,6 +5,8 @@ VITE_ENV=development
 VITE_ENV_SELECTION_ENABLED=true
 # default env in environments admin modal. Can be production, development, next or local. If not provided, VITE_ENV will be used
 VITE_DEFAULT_DATA_ENV=
+# forces maintenance screen. Set to true if Orion service is unavailable for a longer time 
+VITE_FORCE_MAINTENANCE=
 
 # App configuration
 VITE_APP_ID=4414-2

+ 8 - 2
packages/atlas/src/CommonProviders.tsx

@@ -13,6 +13,8 @@ import { OverlayManagerProvider } from '@/providers/overlayManager'
 import { UserProvider } from '@/providers/user/user.provider'
 import { GlobalStyles } from '@/styles'
 
+import { FORCE_MAINTENANCE } from './config/env'
+
 const queryClient = new QueryClient({
   defaultOptions: {
     queries: {
@@ -49,9 +51,13 @@ export const CommonProviders: FC<PropsWithChildren> = ({ children }) => {
 }
 
 const MaintenanceWrapper: FC<PropsWithChildren> = ({ children }) => {
-  const { isKilled, wasKilledLastTime, error, loading } = useGetKillSwitch({ context: { delay: 1000 } })
+  const isMaintenanceForced = FORCE_MAINTENANCE === 'true'
+  const { isKilled, wasKilledLastTime, error, loading } = useGetKillSwitch({
+    context: { delay: 1000 },
+    skip: isMaintenanceForced,
+  })
 
-  if (isKilled || (error && wasKilledLastTime) || (loading && wasKilledLastTime)) {
+  if (isKilled || (error && wasKilledLastTime) || (loading && wasKilledLastTime) || isMaintenanceForced) {
     return <Maintenance />
   } else {
     return <>{children}</>

+ 1 - 0
packages/atlas/src/config/env.ts

@@ -44,3 +44,4 @@ export const DEFAULT_DATA_ENV = readEnv('DEFAUL_DATA_ENV', false, true) || BUILD
 export const JOY_PRICE_SERVICE_URL = readEnv('PRICE_SERVICE_URL', false, true)
 export const USER_LOCATION_SERVICE_URL = readEnv('GEOLOCATION_SERVICE_URL', true, true)
 export const HCAPTCHA_SITE_KEY = readEnv('HCAPTCHA_SITE_KEY', false, true)
+export const FORCE_MAINTENANCE = readEnv('FORCE_MAINTENANCE', false, true)