cmd/dex/serve: add local connector directly to static connectors in storage

This commit is contained in:
rithu john 2017-05-01 15:53:37 -07:00
parent 951fb053a1
commit dc4b97b851

View File

@ -147,15 +147,6 @@ func serve(cmd *cobra.Command, args []string) error {
s = storage.WithStaticPasswords(s, passwords) s = storage.WithStaticPasswords(s, passwords)
} }
if c.EnablePasswordDB {
c.StaticConnectors = append(c.StaticConnectors, Connector{
ID: server.LocalConnector,
Name: "Email",
Type: server.LocalConnector,
})
logger.Infof("config connector: local passwords enabled")
}
storageConnectors := make([]storage.Connector, len(c.StaticConnectors)) storageConnectors := make([]storage.Connector, len(c.StaticConnectors))
for i, c := range c.StaticConnectors { for i, c := range c.StaticConnectors {
if c.ID == "" || c.Name == "" || c.Type == "" { if c.ID == "" || c.Name == "" || c.Type == "" {
@ -174,6 +165,16 @@ func serve(cmd *cobra.Command, args []string) error {
storageConnectors[i] = conn storageConnectors[i] = conn
} }
if c.EnablePasswordDB {
storageConnectors = append(storageConnectors, storage.Connector{
ID: server.LocalConnector,
Name: "Email",
Type: server.LocalConnector,
})
logger.Infof("config connector: local passwords enabled")
}
s = storage.WithStaticConnectors(s, storageConnectors) s = storage.WithStaticConnectors(s, storageConnectors)
if len(c.OAuth2.ResponseTypes) > 0 { if len(c.OAuth2.ResponseTypes) > 0 {