mirror of
https://github.com/go-gitea/gitea.git
synced 2024-12-04 14:46:57 -05:00
Remove unnecessary parameter (#29092)
The parameter extraConfigs has never been used anywhere. This PR just removed it. It can be taken back once it's needed.
This commit is contained in:
parent
98e7e3a5f0
commit
8c6ffdac37
@ -44,12 +44,12 @@ func fatalTestError(fmtStr string, args ...any) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// InitSettings initializes config provider and load common settings for tests
|
// InitSettings initializes config provider and load common settings for tests
|
||||||
func InitSettings(extraConfigs ...string) {
|
func InitSettings() {
|
||||||
if setting.CustomConf == "" {
|
if setting.CustomConf == "" {
|
||||||
setting.CustomConf = filepath.Join(setting.CustomPath, "conf/app-unittest-tmp.ini")
|
setting.CustomConf = filepath.Join(setting.CustomPath, "conf/app-unittest-tmp.ini")
|
||||||
_ = os.Remove(setting.CustomConf)
|
_ = os.Remove(setting.CustomConf)
|
||||||
}
|
}
|
||||||
setting.InitCfgProvider(setting.CustomConf, strings.Join(extraConfigs, "\n"))
|
setting.InitCfgProvider(setting.CustomConf)
|
||||||
setting.LoadCommonSettings()
|
setting.LoadCommonSettings()
|
||||||
|
|
||||||
if err := setting.PrepareAppDataPath(); err != nil {
|
if err := setting.PrepareAppDataPath(); err != nil {
|
||||||
|
@ -196,7 +196,7 @@ func NewConfigProviderFromData(configContent string) (ConfigProvider, error) {
|
|||||||
|
|
||||||
// NewConfigProviderFromFile load configuration from file.
|
// NewConfigProviderFromFile load configuration from file.
|
||||||
// NOTE: do not print any log except error.
|
// NOTE: do not print any log except error.
|
||||||
func NewConfigProviderFromFile(file string, extraConfigs ...string) (ConfigProvider, error) {
|
func NewConfigProviderFromFile(file string) (ConfigProvider, error) {
|
||||||
cfg := ini.Empty(configProviderLoadOptions())
|
cfg := ini.Empty(configProviderLoadOptions())
|
||||||
loadedFromEmpty := true
|
loadedFromEmpty := true
|
||||||
|
|
||||||
@ -213,12 +213,6 @@ func NewConfigProviderFromFile(file string, extraConfigs ...string) (ConfigProvi
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, s := range extraConfigs {
|
|
||||||
if err := cfg.Append([]byte(s)); err != nil {
|
|
||||||
return nil, fmt.Errorf("unable to append more config: %v", err)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
cfg.NameMapper = ini.SnackCase
|
cfg.NameMapper = ini.SnackCase
|
||||||
return &iniConfigProvider{
|
return &iniConfigProvider{
|
||||||
file: file,
|
file: file,
|
||||||
|
@ -90,9 +90,9 @@ func PrepareAppDataPath() error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func InitCfgProvider(file string, extraConfigs ...string) {
|
func InitCfgProvider(file string) {
|
||||||
var err error
|
var err error
|
||||||
if CfgProvider, err = NewConfigProviderFromFile(file, extraConfigs...); err != nil {
|
if CfgProvider, err = NewConfigProviderFromFile(file); err != nil {
|
||||||
log.Fatal("Unable to init config provider from %q: %v", file, err)
|
log.Fatal("Unable to init config provider from %q: %v", file, err)
|
||||||
}
|
}
|
||||||
CfgProvider.DisableSaving() // do not allow saving the CfgProvider into file, it will be polluted by the "MustXxx" calls
|
CfgProvider.DisableSaving() // do not allow saving the CfgProvider into file, it will be polluted by the "MustXxx" calls
|
||||||
|
Loading…
Reference in New Issue
Block a user