refactor: move url choice into nuxt config
This commit is contained in:
parent
69d009d02a
commit
8376dcf565
|
@ -46,7 +46,11 @@ export default defineNuxtConfig({
|
||||||
},
|
},
|
||||||
runtimeConfig: {
|
runtimeConfig: {
|
||||||
env: isCI ? 'deployed' : 'local',
|
env: isCI ? 'deployed' : 'local',
|
||||||
deployUrl: process.env.PULL_REQUEST === 'true' ? process.env.DEPLOY_PRIME_URL : '',
|
deployUrl: !isCI
|
||||||
|
? 'http://localhost:5314'
|
||||||
|
: process.env.PULL_REQUEST === 'true'
|
||||||
|
? process.env.DEPLOY_PRIME_URL
|
||||||
|
: 'https://elk.zone',
|
||||||
cloudflare: {
|
cloudflare: {
|
||||||
accountId: '',
|
accountId: '',
|
||||||
namespaceId: '',
|
namespaceId: '',
|
||||||
|
|
|
@ -14,7 +14,6 @@ import { APP_NAME } from '~/constants'
|
||||||
|
|
||||||
const config = useRuntimeConfig()
|
const config = useRuntimeConfig()
|
||||||
export const HOST_URL = config.deployUrl
|
export const HOST_URL = config.deployUrl
|
||||||
|| (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']
|
||||||
|
@ -26,7 +25,6 @@ if (config.env === 'local') {
|
||||||
storage.mount('servers', fs({ base: 'node_modules/.cache/servers' }))
|
storage.mount('servers', fs({ base: 'node_modules/.cache/servers' }))
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
const config = useRuntimeConfig()
|
|
||||||
storage.mount('servers', cached(kv({
|
storage.mount('servers', cached(kv({
|
||||||
accountId: config.cloudflare.accountId,
|
accountId: config.cloudflare.accountId,
|
||||||
namespaceId: config.cloudflare.namespaceId,
|
namespaceId: config.cloudflare.namespaceId,
|
||||||
|
|
Loading…
Reference in a new issue