forked from Mirrors/elk
fix: move std-env
out of app runtime
This commit is contained in:
parent
3d5a4e6a90
commit
494804fc1c
2 changed files with 6 additions and 5 deletions
|
@ -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: '',
|
||||
|
|
|
@ -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 {
|
||||
|
|
Loading…
Reference in a new issue