Add config flag to control authentication
parent
77764169b4
commit
2c6e2a8a76
|
@ -40,6 +40,10 @@ type Config struct {
|
|||
Version string `toml:"-"`
|
||||
InfluxDBVersion string `toml:"-"`
|
||||
|
||||
Authentication struct {
|
||||
Enabled bool `toml:"enabled"`
|
||||
} `toml:"authentication"`
|
||||
|
||||
Admin struct {
|
||||
Port int `toml:"port"`
|
||||
Assets string `toml:"assets"`
|
||||
|
|
|
@ -47,6 +47,10 @@ func TestParseConfig(t *testing.T) {
|
|||
t.Fatalf("logging level mismatch: %v", c.Logging.Level)
|
||||
}
|
||||
|
||||
if !c.Authentication.Enabled {
|
||||
t.Fatalf("authentication enabled mismatch: %v", c.Authentication.Enabled)
|
||||
}
|
||||
|
||||
if c.Admin.Port != 8083 {
|
||||
t.Fatalf("admin port mismatch: %v", c.Admin.Port)
|
||||
} else if c.Admin.Assets != "./admin" {
|
||||
|
@ -113,6 +117,10 @@ const testFile = `
|
|||
# that can be resolved here.
|
||||
hostname = "myserver.com"
|
||||
|
||||
# Control authentication
|
||||
[authentication]
|
||||
enabled = true
|
||||
|
||||
[logging]
|
||||
# logging level can be one of "debug", "info", "warn" or "error"
|
||||
level = "info"
|
||||
|
|
|
@ -15,6 +15,14 @@ bind-address = "0.0.0.0"
|
|||
# Change this option to true to disable reporting.
|
||||
reporting-disabled = false
|
||||
|
||||
# Control authentication
|
||||
# If not set authetication is DISABLED. Be sure to explicitly set this flag to
|
||||
# true if you want authentication. If authentication is enabled, and no administrative
|
||||
# user exists in the system, the system will allow one administrative user to be
|
||||
# created without requiring any authentication.
|
||||
[authentication]
|
||||
enabled = false
|
||||
|
||||
[logging]
|
||||
# logging level can be one of "fine", "debug", "info", "warn" or "error"
|
||||
level = "info"
|
||||
|
|
Loading…
Reference in New Issue