aboutsummaryrefslogtreecommitdiffstats
path: root/modules/setting/config_env_test.go
diff options
context:
space:
mode:
authorwxiaoguang <wxiaoguang@gmail.com>2023-06-02 17:27:30 +0800
committerGitHub <noreply@github.com>2023-06-02 17:27:30 +0800
commitde4a21fcb4476772c69c36d086549e89ed4dcf6c (patch)
treea8952b92bc6382daffc34178f5d6cc32cfea2efd /modules/setting/config_env_test.go
parent7a5873335afb00dda5fa123fb023c88278e79deb (diff)
downloadgitea-de4a21fcb4476772c69c36d086549e89ed4dcf6c.tar.gz
gitea-de4a21fcb4476772c69c36d086549e89ed4dcf6c.zip
Refactor INI package (first step) (#25024)
The INI package has many bugs and quirks, and in fact it is unmaintained. This PR is the first step for the INI package refactoring: * Use Gitea's "config_provider" to provide INI access * Deprecate the INI package by golangci.yml rule
Diffstat (limited to 'modules/setting/config_env_test.go')
-rw-r--r--modules/setting/config_env_test.go7
1 files changed, 3 insertions, 4 deletions
diff --git a/modules/setting/config_env_test.go b/modules/setting/config_env_test.go
index d49464ecf7..d574554bcc 100644
--- a/modules/setting/config_env_test.go
+++ b/modules/setting/config_env_test.go
@@ -8,7 +8,6 @@ import (
"testing"
"github.com/stretchr/testify/assert"
- "gopkg.in/ini.v1"
)
func TestDecodeEnvSectionKey(t *testing.T) {
@@ -71,15 +70,15 @@ func TestDecodeEnvironmentKey(t *testing.T) {
}
func TestEnvironmentToConfig(t *testing.T) {
- cfg := ini.Empty()
+ cfg, _ := NewConfigProviderFromData("")
changed := EnvironmentToConfig(cfg, "GITEA__", "__FILE", nil)
assert.False(t, changed)
- cfg, err := ini.Load([]byte(`
+ cfg, err := NewConfigProviderFromData(`
[sec]
key = old
-`))
+`)
assert.NoError(t, err)
changed = EnvironmentToConfig(cfg, "GITEA__", "__FILE", []string{"GITEA__sec__key=new"})