chore(updater): internal/updater/loop subpackage
- Do not export updater interface - Export updater struct - Define local interfaces where needed - More restrictive updater loop interface in http control server - Inject `Updater` into updater loop as an interface
This commit is contained in:
@@ -6,12 +6,20 @@ import (
|
||||
"net/http"
|
||||
"strings"
|
||||
|
||||
"github.com/qdm12/gluetun/internal/updater"
|
||||
"github.com/qdm12/gluetun/internal/configuration/settings"
|
||||
"github.com/qdm12/gluetun/internal/models"
|
||||
)
|
||||
|
||||
type UpdaterLooper interface {
|
||||
GetStatus() (status models.LoopStatus)
|
||||
SetStatus(ctx context.Context, status models.LoopStatus) (
|
||||
outcome string, err error)
|
||||
SetSettings(settings settings.Updater) (outcome string)
|
||||
}
|
||||
|
||||
func newUpdaterHandler(
|
||||
ctx context.Context,
|
||||
looper updater.Looper,
|
||||
looper UpdaterLooper,
|
||||
warner warner) http.Handler {
|
||||
return &updaterHandler{
|
||||
ctx: ctx,
|
||||
@@ -22,7 +30,7 @@ func newUpdaterHandler(
|
||||
|
||||
type updaterHandler struct {
|
||||
ctx context.Context //nolint:containedctx
|
||||
looper updater.Looper
|
||||
looper UpdaterLooper
|
||||
warner warner
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user