mirror of
https://github.com/OpenListTeam/OpenList.git
synced 2026-03-13 11:20:33 +00:00
@@ -54,6 +54,7 @@ func InitConfig() {
|
||||
}
|
||||
}
|
||||
configPath = filepath.Clean(configPath)
|
||||
conf.ConfigPath = configPath
|
||||
log.Infof("reading config file: %s", configPath)
|
||||
if !utils.Exists(configPath) {
|
||||
log.Infof("config file not exists, creating default config file")
|
||||
|
||||
@@ -44,6 +44,7 @@ var UpgradePatches = []VersionPatches{
|
||||
Version: "v4.1.9",
|
||||
Patches: []func(){
|
||||
v4_1_9.EnableWebDavProxy,
|
||||
v4_1_9.ResetSkipTlsVerify,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
32
internal/bootstrap/patch/v4_1_9/skip_tls.go
Normal file
32
internal/bootstrap/patch/v4_1_9/skip_tls.go
Normal file
@@ -0,0 +1,32 @@
|
||||
package v4_1_9
|
||||
|
||||
import (
|
||||
"os"
|
||||
"strings"
|
||||
|
||||
"github.com/OpenListTeam/OpenList/v4/internal/conf"
|
||||
"github.com/OpenListTeam/OpenList/v4/pkg/utils"
|
||||
)
|
||||
|
||||
func ResetSkipTlsVerify() {
|
||||
if !conf.Conf.TlsInsecureSkipVerify {
|
||||
return
|
||||
}
|
||||
if !strings.HasPrefix(conf.Version, "v") {
|
||||
return
|
||||
}
|
||||
|
||||
conf.Conf.TlsInsecureSkipVerify = false
|
||||
|
||||
confBody, err := utils.Json.MarshalIndent(conf.Conf, "", " ")
|
||||
if err != nil {
|
||||
utils.Log.Errorf("[ResetSkipTlsVerify] failed to rewrite config: marshal config error: %+v", err)
|
||||
return
|
||||
}
|
||||
err = os.WriteFile(conf.ConfigPath, confBody, 0o777)
|
||||
if err != nil {
|
||||
utils.Log.Errorf("[ResetSkipTlsVerify] failed to rewrite config: update config struct error: %+v", err)
|
||||
return
|
||||
}
|
||||
utils.Log.Infof("[ResetSkipTlsVerify] succeeded to set tls_insecure_skip_verify to false")
|
||||
}
|
||||
@@ -182,7 +182,7 @@ func DefaultConfig(dataDir string) *Config {
|
||||
MmapThreshold: 4,
|
||||
MaxConnections: 0,
|
||||
MaxConcurrency: 64,
|
||||
TlsInsecureSkipVerify: true,
|
||||
TlsInsecureSkipVerify: false,
|
||||
Tasks: TasksConfig{
|
||||
Download: TaskConfig{
|
||||
Workers: 5,
|
||||
|
||||
@@ -15,8 +15,9 @@ var (
|
||||
)
|
||||
|
||||
var (
|
||||
Conf *Config
|
||||
URL *url.URL
|
||||
Conf *Config
|
||||
URL *url.URL
|
||||
ConfigPath string
|
||||
)
|
||||
|
||||
var SlicesMap = make(map[string][]string)
|
||||
|
||||
Reference in New Issue
Block a user