diff options
author | Lunny Xiao <xiaolunwen@gmail.com> | 2023-04-25 23:06:39 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-04-25 23:06:39 +0800 |
commit | 5cf7da63ee74939595b8800787dcdb4c7290fa4f (patch) | |
tree | 39f6c9c6e2a0e78e63949b9299f52a8954abe0bc /modules/setting/storage.go | |
parent | 56d4893b2a996da6388801c9c8ff16b9b588ad55 (diff) | |
download | gitea-5cf7da63ee74939595b8800787dcdb4c7290fa4f.tar.gz gitea-5cf7da63ee74939595b8800787dcdb4c7290fa4f.zip |
Refactor config provider (#24245)
This PR introduces more abstract about `ConfigProvider` and hides more `ini` references.
---------
Co-authored-by: delvh <dev.lh@web.de>
Diffstat (limited to 'modules/setting/storage.go')
-rw-r--r-- | modules/setting/storage.go | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/modules/setting/storage.go b/modules/setting/storage.go index 50d4c8439e..6da52807ec 100644 --- a/modules/setting/storage.go +++ b/modules/setting/storage.go @@ -6,15 +6,13 @@ package setting import ( "path/filepath" "reflect" - - ini "gopkg.in/ini.v1" ) // Storage represents configuration of storages type Storage struct { Type string Path string - Section *ini.Section + Section ConfigSection ServeDirect bool } @@ -30,7 +28,7 @@ func (s *Storage) MapTo(v interface{}) error { return nil } -func getStorage(rootCfg ConfigProvider, name, typ string, targetSec *ini.Section) Storage { +func getStorage(rootCfg ConfigProvider, name, typ string, targetSec ConfigSection) Storage { const sectionName = "storage" sec := rootCfg.Section(sectionName) @@ -52,7 +50,7 @@ func getStorage(rootCfg ConfigProvider, name, typ string, targetSec *ini.Section storage.Section = targetSec storage.Type = typ - overrides := make([]*ini.Section, 0, 3) + overrides := make([]ConfigSection, 0, 3) nameSec, err := rootCfg.GetSection(sectionName + "." + name) if err == nil { overrides = append(overrides, nameSec) |