mirror of
https://github.com/go-gitea/gitea
synced 2024-09-11 00:47:00 +02:00
Fix env config parsing for "GITEA____APP_NAME" (#26001)
Regression of #24832 Fix the bug and add a test for it Co-authored-by: Giteabot <teabot@gitea.io>
This commit is contained in:
parent
d7a8d09da0
commit
28ecac8024
@ -86,7 +86,7 @@ func decodeEnvSectionKey(encoded string) (ok bool, section, key string) {
|
|||||||
key += remaining
|
key += remaining
|
||||||
}
|
}
|
||||||
section = strings.ToLower(section)
|
section = strings.ToLower(section)
|
||||||
ok = section != "" && key != ""
|
ok = key != ""
|
||||||
if !ok {
|
if !ok {
|
||||||
section = ""
|
section = ""
|
||||||
key = ""
|
key = ""
|
||||||
|
@ -48,6 +48,12 @@ func TestDecodeEnvironmentKey(t *testing.T) {
|
|||||||
assert.Equal(t, "", key)
|
assert.Equal(t, "", key)
|
||||||
assert.False(t, file)
|
assert.False(t, file)
|
||||||
|
|
||||||
|
ok, section, key, file = decodeEnvironmentKey(prefix, suffix, "GITEA____KEY")
|
||||||
|
assert.True(t, ok)
|
||||||
|
assert.Equal(t, "", section)
|
||||||
|
assert.Equal(t, "KEY", key)
|
||||||
|
assert.False(t, file)
|
||||||
|
|
||||||
ok, section, key, file = decodeEnvironmentKey(prefix, suffix, "GITEA__SEC__KEY")
|
ok, section, key, file = decodeEnvironmentKey(prefix, suffix, "GITEA__SEC__KEY")
|
||||||
assert.True(t, ok)
|
assert.True(t, ok)
|
||||||
assert.Equal(t, "sec", section)
|
assert.Equal(t, "sec", section)
|
||||||
|
Loading…
Reference in New Issue
Block a user