mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-11-28 15:37:35 +00:00
d887235e08
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.18 Signed-off-by: Earl Warren <contact@earl-warren.org> (cherry picked from commit6cd61e2ab7
) (cherry picked from commit62cae8cc6a
) (cherry picked from commitaee1afc509
) (cherry picked from commit6ba563cd9b
)
22 lines
539 B
Go
22 lines
539 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(prefixRegexpString + "__")
|
|
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, "")
|
|
}
|