feat: expose app version from ConfigMap in sidebar footer
All checks were successful
Build containers when image tags change / build-if-image-changed (frontend, shorefront-frontend, shorefront frontend, frontend/Dockerfile, git.baumann.gr/adebaumann/shorefront-frontend, .frontend.image) (push) Successful in 59s
Build containers when image tags change / build-if-image-changed (backend, shorefront-backend, shorefront backend, backend/Dockerfile, git.baumann.gr/adebaumann/shorefront-backend, .backend.image) (push) Successful in 1m27s
All checks were successful
Build containers when image tags change / build-if-image-changed (frontend, shorefront-frontend, shorefront frontend, frontend/Dockerfile, git.baumann.gr/adebaumann/shorefront-frontend, .frontend.image) (push) Successful in 59s
Build containers when image tags change / build-if-image-changed (backend, shorefront-backend, shorefront backend, backend/Dockerfile, git.baumann.gr/adebaumann/shorefront-backend, .backend.image) (push) Successful in 1m27s
This commit is contained in:
@@ -13,6 +13,7 @@ class Settings(BaseSettings):
|
||||
keycloak_client_id: str
|
||||
keycloak_client_secret: str
|
||||
keycloak_redirect_uri: str
|
||||
app_version: str = "dev"
|
||||
|
||||
class Config:
|
||||
env_file = ".env"
|
||||
|
||||
@@ -28,4 +28,4 @@ app.include_router(params.router, prefix="/configs", tags=["params"])
|
||||
|
||||
@app.get("/health")
|
||||
def health() -> dict:
|
||||
return {"status": "ok"}
|
||||
return {"status": "ok", "version": settings.app_version}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { ReactNode } from 'react'
|
||||
import { ReactNode, useEffect, useState } from 'react'
|
||||
import { useNavigate, useLocation } from 'react-router-dom'
|
||||
import Box from '@mui/material/Box'
|
||||
import Drawer from '@mui/material/Drawer'
|
||||
@@ -13,6 +13,7 @@ import Tooltip from '@mui/material/Tooltip'
|
||||
import DnsIcon from '@mui/icons-material/Dns'
|
||||
import LogoutIcon from '@mui/icons-material/Logout'
|
||||
import { useAuth } from '../store/auth'
|
||||
import api from '../api'
|
||||
|
||||
const DRAWER_WIDTH = 240
|
||||
|
||||
@@ -22,6 +23,11 @@ export default function Layout({ children, title }: Props) {
|
||||
const navigate = useNavigate()
|
||||
const location = useLocation()
|
||||
const { user, logout } = useAuth()
|
||||
const [version, setVersion] = useState<string | null>(null)
|
||||
|
||||
useEffect(() => {
|
||||
api.get('/health').then((r) => setVersion(r.data.version)).catch(() => {})
|
||||
}, [])
|
||||
|
||||
return (
|
||||
<Box sx={{ display: 'flex', minHeight: '100vh' }}>
|
||||
@@ -47,7 +53,10 @@ export default function Layout({ children, title }: Props) {
|
||||
</List>
|
||||
<Divider sx={{ borderColor: '#2d3748' }} />
|
||||
<Box sx={{ px: 2, py: 2, display: 'flex', alignItems: 'center', justifyContent: 'space-between' }}>
|
||||
<Typography variant="caption" sx={{ color: '#94a3b8' }}>{user?.username}</Typography>
|
||||
<Box>
|
||||
<Typography variant="caption" sx={{ color: '#94a3b8', display: 'block' }}>{user?.username}</Typography>
|
||||
{version && <Typography variant="caption" sx={{ color: '#4a5568', fontSize: 10 }}>v{version}</Typography>}
|
||||
</Box>
|
||||
<Tooltip title="Logout">
|
||||
<IconButton onClick={logout} size="small" sx={{ color: '#94a3b8' }}><LogoutIcon fontSize="small" /></IconButton>
|
||||
</Tooltip>
|
||||
|
||||
@@ -110,6 +110,11 @@ spec:
|
||||
secretKeyRef:
|
||||
name: shorefront-secret
|
||||
key: KEYCLOAK_CLIENT_SECRET
|
||||
- name: APP_VERSION
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
name: shorefront-config
|
||||
key: APP_VERSION
|
||||
ports:
|
||||
- containerPort: 8000
|
||||
resources:
|
||||
|
||||
@@ -14,3 +14,4 @@ data:
|
||||
KEYCLOAK_REALM: {{ .Values.keycloak.realm | quote }}
|
||||
KEYCLOAK_CLIENT_ID: {{ .Values.keycloak.clientId | quote }}
|
||||
KEYCLOAK_REDIRECT_URI: {{ .Values.keycloak.redirectUri | quote }}
|
||||
APP_VERSION: {{ .Values.containers.version | quote }}
|
||||
|
||||
@@ -42,4 +42,4 @@ keycloak:
|
||||
redirectUri: https://shorefront.baumann.gr/api/auth/oidc/callback
|
||||
|
||||
containers:
|
||||
version: "0.010"
|
||||
version: "0.012"
|
||||
|
||||
Reference in New Issue
Block a user