feat(confg): reload on save and refactor logging (#275)

* feat(confg): reload on save

* refactor(logging): rework
This commit is contained in:
Ludvig Lundgren 2022-05-20 09:27:01 +02:00 committed by GitHub
parent 198528a474
commit 91b094f4f4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
56 changed files with 995 additions and 873 deletions

View file

@ -19,13 +19,13 @@ type authService interface {
type authHandler struct {
encoder encoder
config domain.Config
config *domain.Config
service authService
cookieStore *sessions.CookieStore
}
func newAuthHandler(encoder encoder, config domain.Config, cookieStore *sessions.CookieStore, service authService) *authHandler {
func newAuthHandler(encoder encoder, config *domain.Config, cookieStore *sessions.CookieStore, service authService) *authHandler {
return &authHandler{
encoder: encoder,
config: config,

View file

@ -3,8 +3,6 @@ package http
import (
"net/http"
"github.com/autobrr/autobrr/internal/config"
"github.com/go-chi/chi"
)
@ -39,14 +37,12 @@ func (h configHandler) Routes(r chi.Router) {
func (h configHandler) getConfig(w http.ResponseWriter, r *http.Request) {
ctx := r.Context()
c := config.Config
conf := configJson{
Host: c.Host,
Port: c.Port,
LogLevel: c.LogLevel,
LogPath: c.LogPath,
BaseURL: c.BaseURL,
Host: h.server.config.Host,
Port: h.server.config.Port,
LogLevel: h.server.config.LogLevel,
LogPath: h.server.config.LogPath,
BaseURL: h.server.config.BaseURL,
Version: h.server.version,
Commit: h.server.commit,
Date: h.server.date,

View file

@ -20,7 +20,7 @@ type Server struct {
sse *sse.Server
db *database.DB
config domain.Config
config *domain.Config
cookieStore *sessions.CookieStore
version string
@ -38,7 +38,7 @@ type Server struct {
releaseService releaseService
}
func NewServer(config domain.Config, sse *sse.Server, db *database.DB, version string, commit string, date string, actionService actionService, authService authService, downloadClientSvc downloadClientService, filterSvc filterService, feedSvc feedService, indexerSvc indexerService, ircSvc ircService, notificationSvc notificationService, releaseSvc releaseService) Server {
func NewServer(config *domain.Config, sse *sse.Server, db *database.DB, version string, commit string, date string, actionService actionService, authService authService, downloadClientSvc downloadClientService, filterSvc filterService, feedSvc feedService, indexerSvc indexerService, ircSvc ircService, notificationSvc notificationService, releaseSvc releaseService) Server {
return Server{
config: config,
sse: sse,