manage auth and add secret
This commit is contained in:
@ -5,25 +5,28 @@ import (
|
||||
|
||||
ini "gopkg.in/ini.v1"
|
||||
)
|
||||
|
||||
// Config is the config
|
||||
type Config struct {
|
||||
HTTP HTTPConfig
|
||||
LDAP LDAPConfig
|
||||
HTTP HTTPConfig
|
||||
LDAP LDAPConfig
|
||||
}
|
||||
|
||||
// HTTPConfig is the http config
|
||||
type HTTPConfig struct {
|
||||
Address string
|
||||
|
||||
Address string
|
||||
Secret string
|
||||
}
|
||||
|
||||
// LDAPConfig is the ldap config
|
||||
type LDAPConfig struct {
|
||||
Base string
|
||||
Host string
|
||||
Port int
|
||||
BindDN string
|
||||
BindPassword string
|
||||
UserFilter string
|
||||
Attributes []string
|
||||
Base string
|
||||
Host string
|
||||
Port int
|
||||
BindDN string
|
||||
BindPassword string
|
||||
UserFilter string
|
||||
Attributes []string
|
||||
}
|
||||
|
||||
// NewFromFile retrieves the configuration from the given file
|
||||
@ -38,11 +41,12 @@ func NewFromFile(filepath string) (*Config, error) {
|
||||
}
|
||||
return config, nil
|
||||
}
|
||||
|
||||
// NewDefault set a default config
|
||||
func NewDefault() *Config {
|
||||
return &Config{
|
||||
HTTP: HTTPConfig{
|
||||
Address: ":3001",
|
||||
Address: ":3001",
|
||||
},
|
||||
LDAP: LDAPConfig{
|
||||
Base: "dc=example,dc=com",
|
||||
@ -53,9 +57,9 @@ func NewDefault() *Config {
|
||||
UserFilter: "(uid=%s)",
|
||||
Attributes: []string{"givenName", "sn", "mail", "uid"},
|
||||
},
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// Dump return the config dump
|
||||
func Dump(config *Config, w io.Writer) error {
|
||||
cfg := ini.Empty()
|
||||
|
Reference in New Issue
Block a user