chore: refine media path configuration in environment files
Some checks failed
Deploy Development / deploy (push) Successful in 36s
Test Suite / pytest-backend (push) Successful in 25s
Test Suite / lint-backend (push) Successful in 1s
Test Suite / build-frontend (push) Successful in 8s
Test Suite / playwright-tests (push) Failing after 1m43s
Some checks failed
Deploy Development / deploy (push) Successful in 36s
Test Suite / pytest-backend (push) Successful in 25s
Test Suite / lint-backend (push) Successful in 1s
Test Suite / build-frontend (push) Successful in 8s
Test Suite / playwright-tests (push) Failing after 1m43s
- Updated .env.example to clarify SHINKAN_MEDIA_HOST usage for different environments. - Modified docker-compose files to set default values for SHINKAN_MEDIA_HOST, ensuring consistent media path handling in development and production. - Enhanced comments for better understanding of media path configurations.
This commit is contained in:
parent
c921f0dd8f
commit
5b13a0a526
|
|
@ -44,7 +44,7 @@ APP_URL=https://shinkan.jinkendo.de
|
|||
ALLOWED_ORIGINS=https://shinkan.jinkendo.de
|
||||
ENVIRONMENT=production
|
||||
|
||||
# Host-Pfad auf dem Rechner (Bind-Mount); im Container siehe MEDIA_ROOT. Pflicht für docker compose up.
|
||||
# Host-Pfad (Bind-Mount). Compose-Defaults: Prod /shinkan-media, Dev /shinkan-media/dev — hier nur setzen zum Überschreiben.
|
||||
SHINKAN_MEDIA_HOST=/shinkan-media
|
||||
# Optional: Pfad im Container (FastAPI MEDIA_ROOT); Standard reicht fast immer.
|
||||
MEDIA_ROOT=/app/media
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
# Medien-Ablage: SHINKAN_MEDIA_HOST in der .env neben dieser Datei setzen (Host-Pfad, Bind-Mount).
|
||||
# Medien: Host-Pfad SHINKAN_MEDIA_HOST in .env überschreiben; Default /shinkan-media/dev (getrennt von Prod).
|
||||
|
||||
services:
|
||||
postgres:
|
||||
|
|
@ -44,7 +44,7 @@ services:
|
|||
MEDIAWIKI_CATEGORY_MODELS: "${MEDIAWIKI_CATEGORY_MODELS:-Reifegradmodelle}"
|
||||
MEDIA_ROOT: "${MEDIA_ROOT:-/app/media}"
|
||||
volumes:
|
||||
- ${SHINKAN_MEDIA_HOST:?SHINKAN_MEDIA_HOST_missing_in_dotenv}:${MEDIA_ROOT:-/app/media}
|
||||
- ${SHINKAN_MEDIA_HOST:-/shinkan-media/dev}:${MEDIA_ROOT:-/app/media}
|
||||
ports:
|
||||
- "8098:8000"
|
||||
depends_on:
|
||||
|
|
|
|||
|
|
@ -51,10 +51,10 @@ services:
|
|||
MEDIAWIKI_CATEGORY_EXERCISES: "${MEDIAWIKI_CATEGORY_EXERCISES:-Übungen}"
|
||||
MEDIAWIKI_CATEGORY_SKILLS: "${MEDIAWIKI_CATEGORY_SKILLS:-Fähigkeitsbeschreibung}"
|
||||
MEDIAWIKI_CATEGORY_METHODS: "${MEDIAWIKI_CATEGORY_METHODS:-Methodenbeschreibung}"
|
||||
# Medien: Pfad im Container (meist /app/media). Host-Pfad für Bind-Mount: SHINKAN_MEDIA_HOST in .env (obligatorisch).
|
||||
# Medien: Container-Pfad MEDIA_ROOT; Host-Pfad SHINKAN_MEDIA_HOST (in .env überschreiben; Default /shinkan-media).
|
||||
MEDIA_ROOT: "${MEDIA_ROOT:-/app/media}"
|
||||
volumes:
|
||||
- ${SHINKAN_MEDIA_HOST:?SHINKAN_MEDIA_HOST_missing_in_dotenv}:${MEDIA_ROOT:-/app/media}
|
||||
- ${SHINKAN_MEDIA_HOST:-/shinkan-media}:${MEDIA_ROOT:-/app/media}
|
||||
ports:
|
||||
- "8003:8000"
|
||||
depends_on:
|
||||
|
|
|
|||
71
frontend/src/ErrorBoundary.jsx
Normal file
71
frontend/src/ErrorBoundary.jsx
Normal file
|
|
@ -0,0 +1,71 @@
|
|||
import React from 'react'
|
||||
|
||||
/**
|
||||
* Fängt Render-Fehler ab — verhindert „weißen Bildschirm“ ohne Hinweis (z. B. nach Deploy/Chaches).
|
||||
*/
|
||||
export default class ErrorBoundary extends React.Component {
|
||||
constructor(props) {
|
||||
super(props)
|
||||
this.state = { error: null }
|
||||
}
|
||||
|
||||
static getDerivedStateFromError(error) {
|
||||
return { error }
|
||||
}
|
||||
|
||||
componentDidCatch(error, info) {
|
||||
console.error('ErrorBoundary:', error, info?.componentStack)
|
||||
}
|
||||
|
||||
render() {
|
||||
if (this.state.error) {
|
||||
const msg = this.state.error?.message || String(this.state.error)
|
||||
return (
|
||||
<div
|
||||
style={{
|
||||
minHeight: '100vh',
|
||||
padding: '24px',
|
||||
fontFamily: 'system-ui, sans-serif',
|
||||
background: '#f8fafc',
|
||||
color: '#0f172a',
|
||||
}}
|
||||
>
|
||||
<h1 style={{ fontSize: '1.25rem', marginBottom: '12px' }}>Ein Fehler ist aufgetreten</h1>
|
||||
<p style={{ marginBottom: '16px', maxWidth: '40rem', lineHeight: 1.5 }}>
|
||||
Die Oberfläche konnte nicht geladen werden. Details siehe unten oder in der
|
||||
Browser-Konsole (F12). Nach einem Deploy einen <strong>harten Reload</strong> (Cache leeren)
|
||||
versuchen.
|
||||
</p>
|
||||
<pre
|
||||
style={{
|
||||
padding: '12px',
|
||||
background: '#fff',
|
||||
border: '1px solid #e2e8f0',
|
||||
borderRadius: 8,
|
||||
overflow: 'auto',
|
||||
fontSize: '0.85rem',
|
||||
}}
|
||||
>
|
||||
{msg}
|
||||
</pre>
|
||||
<p style={{ marginTop: '20px' }}>
|
||||
<button
|
||||
type="button"
|
||||
style={{
|
||||
padding: '10px 16px',
|
||||
borderRadius: 8,
|
||||
border: '1px solid #cbd5e1',
|
||||
background: '#fff',
|
||||
cursor: 'pointer',
|
||||
}}
|
||||
onClick={() => window.location.reload()}
|
||||
>
|
||||
Seite neu laden
|
||||
</button>
|
||||
</p>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
return this.props.children
|
||||
}
|
||||
}
|
||||
|
|
@ -1,10 +1,13 @@
|
|||
import React from 'react'
|
||||
import ReactDOM from 'react-dom/client'
|
||||
import App from './App.jsx'
|
||||
import ErrorBoundary from './ErrorBoundary.jsx'
|
||||
import './app.css'
|
||||
|
||||
ReactDOM.createRoot(document.getElementById('root')).render(
|
||||
<React.StrictMode>
|
||||
<App />
|
||||
<ErrorBoundary>
|
||||
<App />
|
||||
</ErrorBoundary>
|
||||
</React.StrictMode>,
|
||||
)
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user