Initial Baby Step to refactoring settings from global vars to instance (#11777)

* wip: start on refactoring settings

* settings: progress on settings refactor

* refactor: progress on settings refactoring

* fix: fixed failing test

* settings: moved smtp settings from global to instance
This commit is contained in:
Torkel Ödegaard
2018-04-30 16:21:04 +02:00
committed by GitHub
parent fc718b8a9a
commit fa7d7ed5df
28 changed files with 263 additions and 203 deletions
+2 -2
View File
@@ -87,8 +87,8 @@ func TestDashboardImport(t *testing.T) {
func pluginScenario(desc string, t *testing.T, fn func()) {
Convey("Given a plugin", t, func() {
setting.Cfg = ini.Empty()
sec, _ := setting.Cfg.NewSection("plugin.test-app")
setting.Raw = ini.Empty()
sec, _ := setting.Raw.NewSection("plugin.test-app")
sec.NewKey("path", "../../tests/test-app")
pm := &PluginManager{}
+2 -2
View File
@@ -14,8 +14,8 @@ import (
func TestPluginDashboards(t *testing.T) {
Convey("When asking plugin dashboard info", t, func() {
setting.Cfg = ini.Empty()
sec, _ := setting.Cfg.NewSection("plugin.test-app")
setting.Raw = ini.Empty()
sec, _ := setting.Raw.NewSection("plugin.test-app")
sec.NewKey("path", "../../tests/test-app")
pm := &PluginManager{}
+1 -1
View File
@@ -132,7 +132,7 @@ func (pm *PluginManager) Run(ctx context.Context) error {
}
func checkPluginPaths() error {
for _, section := range setting.Cfg.Sections() {
for _, section := range setting.Raw.Sections() {
if strings.HasPrefix(section.Name(), "plugin.") {
path := section.Key("path").String()
if path != "" {
+3 -3
View File
@@ -13,7 +13,7 @@ func TestPluginScans(t *testing.T) {
Convey("When scanning for plugins", t, func() {
setting.StaticRootPath, _ = filepath.Abs("../../public/")
setting.Cfg = ini.Empty()
setting.Raw = ini.Empty()
pm := &PluginManager{}
err := pm.Init()
@@ -28,8 +28,8 @@ func TestPluginScans(t *testing.T) {
})
Convey("When reading app plugin definition", t, func() {
setting.Cfg = ini.Empty()
sec, _ := setting.Cfg.NewSection("plugin.nginx-app")
setting.Raw = ini.Empty()
sec, _ := setting.Raw.NewSection("plugin.nginx-app")
sec.NewKey("path", "../../tests/test-app")
pm := &PluginManager{}