Make listen port configurable (#230)
Co-authored-by: Tobias Hess <tobias.hess@energiekoppler.com>
This commit is contained in:
@ -39,6 +39,7 @@ type Config struct {
|
||||
Path string `long:"url-path" env:"URL_PATH" default:"/_oauth" description:"Callback URL Path"`
|
||||
SecretString string `long:"secret" env:"SECRET" description:"Secret used for signing (required)" json:"-"`
|
||||
Whitelist CommaSeparatedList `long:"whitelist" env:"WHITELIST" env-delim:"," description:"Only allow given email addresses, can be set multiple times"`
|
||||
Port int `long:"port" env:"PORT" default:"4181" description:"Port to listen on"`
|
||||
|
||||
Providers provider.Providers `group:"providers" namespace:"providers" env-namespace:"PROVIDERS"`
|
||||
Rules map[string]*Rule `long:"rule.<name>.<param>" description:"Rule definitions, param can be: \"action\", \"rule\" or \"provider\""`
|
||||
|
@ -37,6 +37,7 @@ func TestConfigDefaults(t *testing.T) {
|
||||
assert.False(c.MatchWhitelistOrDomain)
|
||||
assert.Equal("/_oauth", c.Path)
|
||||
assert.Len(c.Whitelist, 0)
|
||||
assert.Equal(c.Port, 4181)
|
||||
|
||||
assert.Equal("select_account", c.Providers.Google.Prompt)
|
||||
}
|
||||
@ -51,6 +52,7 @@ func TestConfigParseArgs(t *testing.T) {
|
||||
"--rule.1.rule=PathPrefix(`/one`)",
|
||||
"--rule.two.action=auth",
|
||||
"--rule.two.rule=\"Host(`two.com`) && Path(`/two`)\"",
|
||||
"--port=8000",
|
||||
})
|
||||
require.Nil(t, err)
|
||||
|
||||
@ -58,6 +60,7 @@ func TestConfigParseArgs(t *testing.T) {
|
||||
assert.Equal("cookiename", c.CookieName)
|
||||
assert.Equal("csrfcookiename", c.CSRFCookieName)
|
||||
assert.Equal("oidc", c.DefaultProvider)
|
||||
assert.Equal(8000, c.Port)
|
||||
|
||||
// Check rules
|
||||
assert.Equal(map[string]*Rule{
|
||||
|
Reference in New Issue
Block a user