diff --git a/nuxt.config.ts b/nuxt.config.ts index ea3b0ace..af7efcf4 100644 --- a/nuxt.config.ts +++ b/nuxt.config.ts @@ -1,4 +1,5 @@ import Inspect from 'vite-plugin-inspect' +import { isCI } from 'std-env' export default defineNuxtConfig({ ssr: false, @@ -43,6 +44,7 @@ export default defineNuxtConfig({ }, }, runtimeConfig: { + env: isCI ? 'deployed' : 'local', deployUrl: process.env.PULL_REQUEST === 'true' ? process.env.DEPLOY_PRIME_URL : '', cloudflare: { accountId: '', diff --git a/server/shared.ts b/server/shared.ts index 6258b219..5eb997cf 100644 --- a/server/shared.ts +++ b/server/shared.ts @@ -2,7 +2,6 @@ import _fs from 'unstorage/drivers/fs' // @ts-expect-error unstorage needs to provide backwards-compatible subpath types import _kv from 'unstorage/drivers/cloudflare-kv-http' -import { isCI } from 'std-env' import { parseURL } from 'ufo' import { $fetch } from 'ohmyfetch' @@ -13,9 +12,9 @@ import cached from './cache-driver' import type { AppInfo } from '~/types' import { APP_NAME } from '~/constants' -const runtimeConfig = useRuntimeConfig() -export const HOST_URL = runtimeConfig.deployUrl - || (process.dev || !isCI ? 'http://localhost:5314' : 'https://elk.zone') +const config = useRuntimeConfig() +export const HOST_URL = config.deployUrl + || (config.env === 'local' ? 'http://localhost:5314' : 'https://elk.zone') export const HOST_DOMAIN = parseURL(HOST_URL).host! const fs = _fs as typeof import('unstorage/dist/drivers/fs')['default'] @@ -23,7 +22,7 @@ const kv = _kv as typeof import('unstorage/dist/drivers/cloudflare-kv-http')['de const storage = useStorage() as Storage -if (process.dev || !isCI) { +if (config.env === 'local') { storage.mount('servers', fs({ base: 'node_modules/.cache/servers' })) } else {