Добавил докер образ
This commit is contained in:
@@ -3,7 +3,8 @@ const path = require('path')
|
||||
|
||||
const ROOT = path.resolve(__dirname, '..')
|
||||
const ENV_PATH = path.join(ROOT, '.env')
|
||||
const OUT_PATH = path.join(ROOT, 'public', 'config.js')
|
||||
const OUT_PATH =
|
||||
process.env.CONFIG_OUT || path.join(ROOT, 'public', 'config.js')
|
||||
|
||||
const DEFAULTS = {
|
||||
VUE_APP_NAME: 'irandom',
|
||||
@@ -56,8 +57,9 @@ function parseEnvFile(filePath) {
|
||||
return result
|
||||
}
|
||||
|
||||
function buildConfig(env) {
|
||||
const pick = (key) => env[key] || process.env[key] || DEFAULTS[key]
|
||||
function buildConfig(fileEnv) {
|
||||
// Container / shell env overrides .env file
|
||||
const pick = (key) => process.env[key] || fileEnv[key] || DEFAULTS[key]
|
||||
|
||||
return {
|
||||
name: pick('VUE_APP_NAME'),
|
||||
@@ -88,5 +90,6 @@ const output = `/* Generated by scripts/generate-config.js — do not edit by ha
|
||||
window.__APP_CONFIG__ = ${payload};
|
||||
`
|
||||
|
||||
fs.mkdirSync(path.dirname(OUT_PATH), { recursive: true })
|
||||
fs.writeFileSync(OUT_PATH, output, 'utf8')
|
||||
console.log(`Wrote ${path.relative(ROOT, OUT_PATH)}`)
|
||||
console.log(`Wrote ${OUT_PATH}`)
|
||||
|
||||
Reference in New Issue
Block a user