76ba500417
CI / docker (push) Successful in 2m4s
OpenAI-compatible AI gateway with Vue admin UI, multi-provider egress, ingress key governance, monitoring, and security controls. Co-authored-by: Cursor <cursoragent@cursor.com>
30 lines
749 B
Go
30 lines
749 B
Go
package admin
|
|
|
|
import (
|
|
"net/http"
|
|
|
|
"github.com/gin-gonic/gin"
|
|
"github.com/rose_cat707/luminary/internal/settings"
|
|
)
|
|
|
|
func (h *Handler) GetSettings(c *gin.Context) {
|
|
c.JSON(http.StatusOK, h.settings.PublicView())
|
|
}
|
|
|
|
func (h *Handler) UpdateSettings(c *gin.Context) {
|
|
var in settings.UpdateInput
|
|
if err := c.ShouldBindJSON(&in); err != nil {
|
|
c.JSON(http.StatusBadRequest, gin.H{"error": "invalid request"})
|
|
return
|
|
}
|
|
if err := h.settings.Update(in); err != nil {
|
|
c.JSON(http.StatusInternalServerError, gin.H{"error": err.Error()})
|
|
return
|
|
}
|
|
h.loginLimit.Configure(h.settings.LoginMaxAttempts(), h.settings.LoginLockout())
|
|
if h.monitor != nil {
|
|
h.monitor.NotifySettingsChanged()
|
|
}
|
|
c.JSON(http.StatusOK, h.settings.PublicView())
|
|
}
|