mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2024-11-27 20:49:03 +08:00
feat: 修改配置文件,删除无用代码
This commit is contained in:
parent
493fb57dff
commit
cb281b2513
@ -8,8 +8,8 @@ type System struct {
|
||||
DataDir string `mapstructure:"data_dir"`
|
||||
Cache string `mapstructure:"cache"`
|
||||
Backup string `mapstructure:"backup"`
|
||||
AppOss string `mapstructure:"app_oss"`
|
||||
AppRepoOwner string `mapstructure:"app_repo_owner"`
|
||||
AppRepoName string `mapstructure:"app_repo_name"`
|
||||
EncryptKey string `mapstructure:"encrypt_key"`
|
||||
BaseDir string `mapstructure:"base_dir"`
|
||||
}
|
||||
|
@ -18,6 +18,7 @@ import (
|
||||
|
||||
func Init() {
|
||||
baseDir := "/opt"
|
||||
mode := "local"
|
||||
fileOp := files.NewFileOp()
|
||||
v := viper.NewWithOptions()
|
||||
v.SetConfigType("yaml")
|
||||
@ -28,6 +29,7 @@ func Init() {
|
||||
panic(fmt.Errorf("Fatal error config file: %s \n", err))
|
||||
}
|
||||
} else {
|
||||
mode = "release"
|
||||
stdout, err := cmd.Exec("grep '^BASE_DIR=' /usr/bin/1pctl | cut -d'=' -f2")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
@ -50,6 +52,9 @@ func Init() {
|
||||
if err := v.Unmarshal(&serverConfig); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
if mode == "local" && serverConfig.System.BaseDir != "" {
|
||||
baseDir = serverConfig.System.BaseDir
|
||||
}
|
||||
global.CONF = serverConfig
|
||||
global.CONF.BaseDir = baseDir
|
||||
global.CONF.System.DataDir = global.CONF.BaseDir + "/1panel"
|
||||
|
@ -6,6 +6,7 @@ import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"gitee.com/openeuler/go-gitee/gitee"
|
||||
"github.com/1Panel-dev/1Panel/backend/global"
|
||||
"github.com/google/go-github/github"
|
||||
"net/http"
|
||||
"time"
|
||||
@ -28,10 +29,14 @@ func CheckAndGetInfo(owner, repoName string) (*RepoInfo, error) {
|
||||
res, err := getLatestRepoInfo(repoType, owner, repoName)
|
||||
if err == nil {
|
||||
return res, nil
|
||||
} else {
|
||||
global.LOG.Errorf("get %s last release version failed %s", repoType, err.Error())
|
||||
}
|
||||
} else {
|
||||
global.LOG.Errorf("get %s remote repo [%s] failed", repoType, url)
|
||||
}
|
||||
}
|
||||
return nil, errors.New("remote repo get failed")
|
||||
return nil, errors.New("all remote repo get failed")
|
||||
}
|
||||
|
||||
func checkValid(addr string) bool {
|
||||
|
@ -1,8 +1,8 @@
|
||||
system:
|
||||
db_file: 1Panel.db
|
||||
app_oss: "https://1panel.oss-cn-hangzhou.aliyuncs.com"
|
||||
app_repo_owner: "1Panel-dev"
|
||||
app_repo_name: 'appstore'
|
||||
app_repo_owner: 1Panel-dev
|
||||
app_repo_name: appstore
|
||||
base_dir: /opt
|
||||
|
||||
log:
|
||||
level: debug
|
||||
|
Loading…
Reference in New Issue
Block a user