fix: exception in standalone mode

This commit is contained in:
hiddify
2024-09-29 22:58:36 +02:00
parent aa3a9567fd
commit 4d77927f91
3 changed files with 5 additions and 1 deletions

View File

@@ -23,5 +23,6 @@ func init() {
}
func runCommand(cmd *cobra.Command, args []string) {
v2.Setup("./tmp", "./", "./tmp", 0, false)
v2.RunStandalone(hiddifySettingPath, configPath, defaultConfigs)
}

View File

@@ -40,7 +40,9 @@ func (s *StorageService) Start() error {
}
func (s *StorageService) Close() error {
Storage.DB.Close()
if Storage.DB != nil {
Storage.DB.Close()
}
return nil
}

View File

@@ -18,6 +18,7 @@ func Register(service adapter.Service) {
}
func StartServices() error {
CloseServices()
for _, service := range preservices {
if err := service.Start(); err != nil {
return err