| @@ -109,6 +109,8 @@ public class SecurityConfig { | |||||
| .hasAnyAuthority("TESTING", "ADMIN") | .hasAnyAuthority("TESTING", "ADMIN") | ||||
| .requestMatchers(HttpMethod.GET, "/label-printer-monitor/label-stats") | .requestMatchers(HttpMethod.GET, "/label-printer-monitor/label-stats") | ||||
| .hasAnyAuthority("TESTING", "ADMIN") | .hasAnyAuthority("TESTING", "ADMIN") | ||||
| .requestMatchers(HttpMethod.GET, "/label-printer-monitor/odometer-stats") | |||||
| .hasAnyAuthority("TESTING", "ADMIN") | |||||
| .requestMatchers(HttpMethod.POST, "/stockAdjustment/submit") | .requestMatchers(HttpMethod.POST, "/stockAdjustment/submit") | ||||
| .hasAnyAuthority("ADMIN", "INVENTORY_ADJUST") | .hasAnyAuthority("ADMIN", "INVENTORY_ADJUST") | ||||
| .anyRequest().authenticated()) | .anyRequest().authenticated()) | ||||
| @@ -1,7 +1,6 @@ | |||||
| package com.ffii.fpsms.modules.monitoring.web | package com.ffii.fpsms.modules.monitoring.web | ||||
| import com.ffii.fpsms.modules.monitoring.service.LabelPrinterMonitorService | import com.ffii.fpsms.modules.monitoring.service.LabelPrinterMonitorService | ||||
| import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty | |||||
| import org.springframework.http.ResponseEntity | import org.springframework.http.ResponseEntity | ||||
| import org.springframework.web.bind.annotation.GetMapping | import org.springframework.web.bind.annotation.GetMapping | ||||
| import org.springframework.web.bind.annotation.PostMapping | import org.springframework.web.bind.annotation.PostMapping | ||||
| @@ -12,9 +11,9 @@ import java.time.LocalDate | |||||
| import java.time.LocalDateTime | import java.time.LocalDateTime | ||||
| import java.time.format.DateTimeParseException | import java.time.format.DateTimeParseException | ||||
| /** Always registered so the monitor UI can probe label printers on demand (schedulers stay profile-gated). */ | |||||
| @RestController | @RestController | ||||
| @RequestMapping("/label-printer-monitor") | @RequestMapping("/label-printer-monitor") | ||||
| @ConditionalOnProperty(prefix = "fpsms.monitoring", name = ["enabled"], havingValue = "true") | |||||
| class LabelPrinterMonitorController( | class LabelPrinterMonitorController( | ||||
| private val labelPrinterMonitorService: LabelPrinterMonitorService, | private val labelPrinterMonitorService: LabelPrinterMonitorService, | ||||
| ) { | ) { | ||||
| @@ -1,7 +1,6 @@ | |||||
| package com.ffii.fpsms.modules.monitoring.web | package com.ffii.fpsms.modules.monitoring.web | ||||
| import com.ffii.fpsms.modules.monitoring.service.PrinterMonitorService | import com.ffii.fpsms.modules.monitoring.service.PrinterMonitorService | ||||
| import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty | |||||
| import org.springframework.http.ResponseEntity | import org.springframework.http.ResponseEntity | ||||
| import org.springframework.web.bind.annotation.GetMapping | import org.springframework.web.bind.annotation.GetMapping | ||||
| import org.springframework.web.bind.annotation.PostMapping | import org.springframework.web.bind.annotation.PostMapping | ||||
| @@ -12,9 +11,9 @@ import java.time.LocalDate | |||||
| import java.time.LocalDateTime | import java.time.LocalDateTime | ||||
| import java.time.format.DateTimeParseException | import java.time.format.DateTimeParseException | ||||
| /** Always registered so the monitor UI can probe printers on demand (schedulers stay profile-gated). */ | |||||
| @RestController | @RestController | ||||
| @RequestMapping("/printer-monitor") | @RequestMapping("/printer-monitor") | ||||
| @ConditionalOnProperty(prefix = "fpsms.monitoring", name = ["enabled"], havingValue = "true") | |||||
| class PrinterMonitorController( | class PrinterMonitorController( | ||||
| private val printerMonitorService: PrinterMonitorService, | private val printerMonitorService: PrinterMonitorService, | ||||
| ) { | ) { | ||||
| @@ -4,7 +4,8 @@ spring: | |||||
| username: root | username: root | ||||
| password: secret | password: secret | ||||
| # Monitoring off for local dev (prod only). To test: enabled true + frontend NEXT_PUBLIC_MONITORING_ENABLED=true. | |||||
| # Monitoring off for local dev (prod only). Printer/device monitor APIs are always registered; | |||||
| # background schedulers only run when enabled is true. | |||||
| fpsms: | fpsms: | ||||
| monitoring: | monitoring: | ||||
| enabled: false | enabled: false | ||||