docs: config.example.js auf aktuelles Runtime-Config-Pattern gebracht
This commit is contained in:
parent
682dd4183e
commit
4cd9764cec
@ -1,6 +1,21 @@
|
||||
// Frontend-Konfiguration — VOR dem Build anpassen, dann als config.js speichern
|
||||
// Frontend-Konfiguration — als config.js speichern vor dem Build
|
||||
// config.js ist in .gitignore und wird NICHT eingecheckt
|
||||
//
|
||||
// Priorität: 1. window.__RMM_CONFIG__ (Docker Runtime-Injection)
|
||||
// 2. Vite ENV-Variablen (.env / --env beim Build)
|
||||
// 3. Fallback-Werte hier
|
||||
//
|
||||
// Docker-Beispiel (nginx config.js-Injection):
|
||||
// window.__RMM_CONFIG__ = { backendHost: "192.168.1.10", backendPort: "8443", apiKey: "abc123" }
|
||||
//
|
||||
// .env-Beispiel:
|
||||
// VITE_BACKEND_HOST=192.168.1.10
|
||||
// VITE_BACKEND_PORT=8443
|
||||
// VITE_API_KEY=abc123
|
||||
|
||||
export const BACKEND_HOST = 'BACKEND_IP_ODER_HOSTNAME'
|
||||
export const BACKEND_URL = `https://${BACKEND_HOST}:8443`
|
||||
export const API_KEY = 'DEIN_API_KEY'
|
||||
const rt = window.__RMM_CONFIG__ || {}
|
||||
|
||||
export const BACKEND_HOST = rt.backendHost || import.meta.env.VITE_BACKEND_HOST || 'localhost'
|
||||
export const BACKEND_PORT = rt.backendPort || import.meta.env.VITE_BACKEND_PORT || '8443'
|
||||
export const BACKEND_URL = `https://${BACKEND_HOST}:${BACKEND_PORT}`
|
||||
export const API_KEY = rt.apiKey || import.meta.env.VITE_API_KEY || ''
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user