mirror of
https://github.com/ThatGuySam/doesitarm.git
synced 2026-05-18 06:44:46 -07:00
Add publicRuntimeConfig helper
This commit is contained in:
parent
20a9d33dfd
commit
f6a1dacd54
1 changed files with 22 additions and 0 deletions
22
helpers/public-runtime-config.mjs
Normal file
22
helpers/public-runtime-config.mjs
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
import dotenv from 'dotenv'
|
||||
|
||||
dotenv.config()
|
||||
|
||||
|
||||
|
||||
export const publicRuntimeConfig = {
|
||||
allUpdateSubscribe: process.env.ALL_UPDATE_SUBSCRIBE,
|
||||
testResultStore: process.env.TEST_RESULT_STORE,
|
||||
siteUrl: process.env.URL
|
||||
}
|
||||
|
||||
export function makeViteDefinitions () {
|
||||
const definitions = {}
|
||||
|
||||
for ( const key in publicRuntimeConfig ) {
|
||||
definitions[`this.$config.${key}`] = JSON.stringify( publicRuntimeConfig[key] )
|
||||
definitions[`global.$config.${key}`] = JSON.stringify( publicRuntimeConfig[key] )
|
||||
}
|
||||
|
||||
return definitions
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue