mirror of
https://github.com/stashapp/stash.git
synced 2025-12-17 12:24:38 +03:00
Refresh config when paths change (#217)
This commit is contained in:
@@ -6,6 +6,7 @@ import (
|
|||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
|
||||||
"github.com/stashapp/stash/pkg/logger"
|
"github.com/stashapp/stash/pkg/logger"
|
||||||
|
"github.com/stashapp/stash/pkg/manager"
|
||||||
"github.com/stashapp/stash/pkg/manager/config"
|
"github.com/stashapp/stash/pkg/manager/config"
|
||||||
"github.com/stashapp/stash/pkg/models"
|
"github.com/stashapp/stash/pkg/models"
|
||||||
"github.com/stashapp/stash/pkg/utils"
|
"github.com/stashapp/stash/pkg/utils"
|
||||||
@@ -75,6 +76,8 @@ func (r *mutationResolver) ConfigureGeneral(ctx context.Context, input models.Co
|
|||||||
return makeConfigGeneralResult(), err
|
return makeConfigGeneralResult(), err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
manager.GetInstance().RefreshConfig()
|
||||||
|
|
||||||
return makeConfigGeneralResult(), nil
|
return makeConfigGeneralResult(), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ import (
|
|||||||
"github.com/gorilla/websocket"
|
"github.com/gorilla/websocket"
|
||||||
"github.com/rs/cors"
|
"github.com/rs/cors"
|
||||||
"github.com/stashapp/stash/pkg/logger"
|
"github.com/stashapp/stash/pkg/logger"
|
||||||
|
"github.com/stashapp/stash/pkg/manager"
|
||||||
"github.com/stashapp/stash/pkg/manager/config"
|
"github.com/stashapp/stash/pkg/manager/config"
|
||||||
"github.com/stashapp/stash/pkg/manager/paths"
|
"github.com/stashapp/stash/pkg/manager/paths"
|
||||||
"github.com/stashapp/stash/pkg/models"
|
"github.com/stashapp/stash/pkg/models"
|
||||||
@@ -183,6 +184,8 @@ func Start() {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
manager.GetInstance().RefreshConfig()
|
||||||
|
|
||||||
http.Redirect(w, r, "/", 301)
|
http.Redirect(w, r, "/", 301)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ func Initialize() *singleton {
|
|||||||
JSON: &jsonUtils{},
|
JSON: &jsonUtils{},
|
||||||
}
|
}
|
||||||
|
|
||||||
instance.refreshConfig()
|
instance.RefreshConfig()
|
||||||
|
|
||||||
initFFMPEG()
|
initFFMPEG()
|
||||||
})
|
})
|
||||||
@@ -131,7 +131,7 @@ func initLog() {
|
|||||||
logger.Init(config.GetLogFile(), config.GetLogOut(), config.GetLogLevel())
|
logger.Init(config.GetLogFile(), config.GetLogOut(), config.GetLogLevel())
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *singleton) refreshConfig() {
|
func (s *singleton) RefreshConfig() {
|
||||||
s.Paths = paths.NewPaths()
|
s.Paths = paths.NewPaths()
|
||||||
if config.IsValid() {
|
if config.IsValid() {
|
||||||
_ = utils.EnsureDir(s.Paths.Generated.Screenshots)
|
_ = utils.EnsureDir(s.Paths.Generated.Screenshots)
|
||||||
|
|||||||
Reference in New Issue
Block a user