diff --git a/.env.example b/.env.example index 755b4bc..c333141 100644 --- a/.env.example +++ b/.env.example @@ -5,6 +5,13 @@ MYSQL_DATABASE=ik_kontroll MYSQL_USER=ik_user MYSQL_PASSWORD=ik_pass +# ── Spring datasource overrides ─────────────────────────────────────────────── +# Optional when running locally outside Docker Compose. Docker Compose sets these +# automatically for the backend container. +SPRING_DATASOURCE_URL=jdbc:mysql://localhost:3306/ik_kontroll?allowPublicKeyRetrieval=true&useSSL=false&serverTimezone=UTC&characterEncoding=UTF-8&useUnicode=true +SPRING_DATASOURCE_USERNAME=ik_user +SPRING_DATASOURCE_PASSWORD=ik_pass + # ── JWT secret ──────────────────────────────────────────────────────────────── # Must be at least 32 characters. Change this to something random in production. JWT_SECRET=local-dev-secret-please-change-this-for-production-use-only diff --git a/backend/src/main/resources/application-dev.properties b/backend/src/main/resources/application-dev.properties index 1e22cf6..39bd8ff 100644 --- a/backend/src/main/resources/application-dev.properties +++ b/backend/src/main/resources/application-dev.properties @@ -1,6 +1,14 @@ # Flyway in dev: run normal schema migrations + dev-only seed migrations spring.flyway.locations=classpath:db/migration,classpath:db/migration-dev +# Local datasource defaults for IDE runs. Docker Compose overrides these with +# SPRING_DATASOURCE_* environment variables when the app runs in containers. +spring.datasource.url=${SPRING_DATASOURCE_URL:jdbc:mysql://localhost:3306/${MYSQL_DATABASE:ik_kontroll}?allowPublicKeyRetrieval=true&useSSL=false&serverTimezone=UTC&characterEncoding=UTF-8&useUnicode=true} +spring.datasource.username=${SPRING_DATASOURCE_USERNAME:${MYSQL_USER:ik_user}} +spring.datasource.password=${SPRING_DATASOURCE_PASSWORD:${MYSQL_PASSWORD:ik_pass}} +spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver +spring.jpa.database-platform=org.hibernate.dialect.MySQLDialect + # Allow Flyway to wipe and rebuild schema if it finds a failed migration record spring.flyway.clean-disabled=false spring.flyway.clean-on-validation-error=true diff --git a/frontend/src/views/GraphView.vue b/frontend/src/views/GraphView.vue index 61c0b7a..793816e 100644 --- a/frontend/src/views/GraphView.vue +++ b/frontend/src/views/GraphView.vue @@ -163,7 +163,7 @@ const lineChartOptions = computed(() => ({ callbacks: { label: (ctx: any) => { const ds = visibleDatasets.value[ctx.datasetIndex] - if (!ds || ctx.parsed.y == null) return null + if (!ds || ctx.parsed.y == null) return undefined const val: number = ctx.parsed.y const hasThresholds = ds.minThreshold != null && ds.maxThreshold != null const isOut = hasThresholds && (val < ds.minThreshold || val > ds.maxThreshold) @@ -171,7 +171,7 @@ const lineChartOptions = computed(() => ({ }, afterLabel: (ctx: any) => { const ds = visibleDatasets.value[ctx.datasetIndex] - if (!ds || ctx.parsed.y == null || ds.minThreshold == null || ds.maxThreshold == null) return null + if (!ds || ctx.parsed.y == null || ds.minThreshold == null || ds.maxThreshold == null) return undefined return ` Grense: ${ds.minThreshold}°C – ${ds.maxThreshold}°C` }, },