925dcf1692
Add the FORGEJO__ prefix as equivalent to GITEA__ when interpreted by environment-to-ini. It is used when running the Forgejo container like so: docker run --name forgejo -e FORGEJO__security__INSTALL_LOCK=true \ -d codeberg.org/forgejo/forgejo:1.19 (cherry picked from commit6cd61e2ab7
) (cherry picked from commit62cae8cc6a
) (cherry picked from commitaee1afc509
) (cherry picked from commit6ba563cd9b
) (cherry picked from commit6429b20f4a
) (cherry picked from commitdd545aa077
) (cherry picked from commit63a00e573e
) (cherry picked from commit8e35a50b91
) (cherry picked from commit26e8fb6cd9
) (cherry picked from commit56bbf644be
) (cherry picked from commit4d0a8c8640
) (cherry picked from commitb58f775fa2
) (cherry picked from commitf4b6fa7a93
) (cherry picked from commit4eca363082
) (cherry picked from commite2e7a72f80
) (cherry picked from commit00ce992957
) (cherry picked from commit971b26ec1c
) (cherry picked from commitdd2f0046bd
)
21 lines
538 B
Go
21 lines
538 B
Go
// Copyright 2023 The Forgejo Authors. All rights reserved.
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
package main
|
|
|
|
import (
|
|
"regexp"
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func Test_splitEnvironmentVariable(t *testing.T) {
|
|
prefixRegexp := regexp.MustCompile(EnvironmentPrefix + "__")
|
|
k, v := splitEnvironmentVariable(prefixRegexp, "FORGEJO__KEY=VALUE")
|
|
assert.Equal(t, k, "KEY")
|
|
assert.Equal(t, v, "VALUE")
|
|
k, v = splitEnvironmentVariable(prefixRegexp, "nothing=interesting")
|
|
assert.Equal(t, k, "")
|
|
assert.Equal(t, v, "")
|
|
}
|