mirror of
https://github.com/stashapp/stash.git
synced 2025-12-17 20:34:37 +03:00
Fix initial setup issue issues (#1380)
* Refactor initial setup behaviour * Adjust wizard
This commit is contained in:
@@ -49,6 +49,11 @@ func Initialize() *singleton {
|
||||
once.Do(func() {
|
||||
_ = utils.EnsureDir(paths.GetStashHomeDirectory())
|
||||
cfg, err := config.Initialize()
|
||||
|
||||
if err != nil {
|
||||
panic(fmt.Sprintf("error initializing configuration: %s", err.Error()))
|
||||
}
|
||||
|
||||
initLog()
|
||||
|
||||
instance = &singleton{
|
||||
@@ -59,8 +64,7 @@ func Initialize() *singleton {
|
||||
TxnManager: sqlite.NewTransactionManager(),
|
||||
}
|
||||
|
||||
cfgFile := cfg.GetConfigFile()
|
||||
if cfgFile != "" {
|
||||
if !cfg.IsNewSystem() {
|
||||
logger.Infof("using config file: %s", cfg.GetConfigFile())
|
||||
|
||||
if err == nil {
|
||||
@@ -75,7 +79,11 @@ func Initialize() *singleton {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
logger.Warn("config file not found. Assuming new system...")
|
||||
cfgFile := cfg.GetConfigFile()
|
||||
if cfgFile != "" {
|
||||
cfgFile = cfgFile + " "
|
||||
}
|
||||
logger.Warnf("config file %snot found. Assuming new system...", cfgFile)
|
||||
}
|
||||
|
||||
initFFMPEG()
|
||||
@@ -235,6 +243,8 @@ func (s *singleton) Setup(input models.SetupInput) error {
|
||||
return fmt.Errorf("error initializing the database: %s", err.Error())
|
||||
}
|
||||
|
||||
s.Config.FinalizeSetup()
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -283,8 +293,9 @@ func (s *singleton) GetSystemStatus() *models.SystemStatus {
|
||||
dbSchema := int(database.Version())
|
||||
dbPath := database.DatabasePath()
|
||||
appSchema := int(database.AppSchemaVersion())
|
||||
configFile := s.Config.GetConfigFile()
|
||||
|
||||
if s.Config.GetConfigFile() == "" {
|
||||
if s.Config.IsNewSystem() {
|
||||
status = models.SystemStatusEnumSetup
|
||||
} else if dbSchema < appSchema {
|
||||
status = models.SystemStatusEnumNeedsMigration
|
||||
@@ -295,5 +306,6 @@ func (s *singleton) GetSystemStatus() *models.SystemStatus {
|
||||
DatabasePath: &dbPath,
|
||||
AppSchema: appSchema,
|
||||
Status: status,
|
||||
ConfigPath: &configFile,
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user