mirror of https://github.com/1Panel-dev/1Panel
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
671 B
23 lines
671 B
package hook
|
|
|
|
import (
|
|
"github.com/1Panel-dev/1Panel/backend/app/repo"
|
|
"github.com/1Panel-dev/1Panel/backend/global"
|
|
)
|
|
|
|
func Init() {
|
|
settingRepo := repo.NewISettingRepo()
|
|
portSetting, err := settingRepo.Get(settingRepo.WithByKey("ServerPort"))
|
|
if err != nil {
|
|
global.LOG.Errorf("load service port from setting failed, err: %v", err)
|
|
}
|
|
global.CONF.System.Port = portSetting.Value
|
|
|
|
if _, err := settingRepo.Get(settingRepo.WithByKey("SystemStatus")); err != nil {
|
|
_ = settingRepo.Create("SystemStatus", "Free")
|
|
}
|
|
if err := settingRepo.Update("SystemStatus", "Free"); err != nil {
|
|
global.LOG.Fatalf("init service before start failed, err: %v", "Free")
|
|
}
|
|
}
|