fix: move `std-env` out of app runtime
parent
3d5a4e6a90
commit
494804fc1c
|
@ -1,4 +1,5 @@
|
||||||
import Inspect from 'vite-plugin-inspect'
|
import Inspect from 'vite-plugin-inspect'
|
||||||
|
import { isCI } from 'std-env'
|
||||||
|
|
||||||
export default defineNuxtConfig({
|
export default defineNuxtConfig({
|
||||||
ssr: false,
|
ssr: false,
|
||||||
|
@ -43,6 +44,7 @@ export default defineNuxtConfig({
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
runtimeConfig: {
|
runtimeConfig: {
|
||||||
|
env: isCI ? 'deployed' : 'local',
|
||||||
deployUrl: process.env.PULL_REQUEST === 'true' ? process.env.DEPLOY_PRIME_URL : '',
|
deployUrl: process.env.PULL_REQUEST === 'true' ? process.env.DEPLOY_PRIME_URL : '',
|
||||||
cloudflare: {
|
cloudflare: {
|
||||||
accountId: '',
|
accountId: '',
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
import _fs from 'unstorage/drivers/fs'
|
import _fs from 'unstorage/drivers/fs'
|
||||||
// @ts-expect-error unstorage needs to provide backwards-compatible subpath types
|
// @ts-expect-error unstorage needs to provide backwards-compatible subpath types
|
||||||
import _kv from 'unstorage/drivers/cloudflare-kv-http'
|
import _kv from 'unstorage/drivers/cloudflare-kv-http'
|
||||||
import { isCI } from 'std-env'
|
|
||||||
import { parseURL } from 'ufo'
|
import { parseURL } from 'ufo'
|
||||||
|
|
||||||
import { $fetch } from 'ohmyfetch'
|
import { $fetch } from 'ohmyfetch'
|
||||||
|
@ -13,9 +12,9 @@ import cached from './cache-driver'
|
||||||
import type { AppInfo } from '~/types'
|
import type { AppInfo } from '~/types'
|
||||||
import { APP_NAME } from '~/constants'
|
import { APP_NAME } from '~/constants'
|
||||||
|
|
||||||
const runtimeConfig = useRuntimeConfig()
|
const config = useRuntimeConfig()
|
||||||
export const HOST_URL = runtimeConfig.deployUrl
|
export const HOST_URL = config.deployUrl
|
||||||
|| (process.dev || !isCI ? 'http://localhost:5314' : 'https://elk.zone')
|
|| (config.env === 'local' ? 'http://localhost:5314' : 'https://elk.zone')
|
||||||
export const HOST_DOMAIN = parseURL(HOST_URL).host!
|
export const HOST_DOMAIN = parseURL(HOST_URL).host!
|
||||||
|
|
||||||
const fs = _fs as typeof import('unstorage/dist/drivers/fs')['default']
|
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
|
const storage = useStorage() as Storage
|
||||||
|
|
||||||
if (process.dev || !isCI) {
|
if (config.env === 'local') {
|
||||||
storage.mount('servers', fs({ base: 'node_modules/.cache/servers' }))
|
storage.mount('servers', fs({ base: 'node_modules/.cache/servers' }))
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
Loading…
Reference in New Issue