From 07af73f367e0e07b62179100e74ceb253c8c726e Mon Sep 17 00:00:00 2001 From: Eric Chiang Date: Tue, 9 Feb 2016 16:31:32 -0800 Subject: [PATCH] *: don't allow sqlite3 if --no-db flag not specified --- cmd/dex-overlord/main.go | 4 ++++ server/config.go | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/cmd/dex-overlord/main.go b/cmd/dex-overlord/main.go index d18271ce..1d3eb5de 100644 --- a/cmd/dex-overlord/main.go +++ b/cmd/dex-overlord/main.go @@ -12,6 +12,7 @@ import ( "time" "github.com/coreos/go-oidc/key" + "github.com/go-gorp/gorp" "github.com/coreos/dex/admin" "github.com/coreos/dex/db" @@ -94,6 +95,9 @@ func main() { if err != nil { log.Fatalf(err.Error()) } + if _, ok := dbc.Dialect.(gorp.PostgresDialect); !ok { + log.Fatal("only postgres backend supported for multi server configurations") + } if *dbMigrate { var sleep time.Duration diff --git a/server/config.go b/server/config.go index fac9ef35..b051ac3f 100644 --- a/server/config.go +++ b/server/config.go @@ -14,6 +14,7 @@ import ( "github.com/coreos/go-oidc/key" "github.com/coreos/go-oidc/oidc" "github.com/coreos/pkg/health" + "github.com/go-gorp/gorp" "github.com/coreos/dex/connector" "github.com/coreos/dex/db" @@ -222,6 +223,9 @@ func (cfg *MultiServerConfig) Configure(srv *Server) error { if err != nil { return fmt.Errorf("unable to initialize database connection: %v", err) } + if _, ok := dbc.Dialect.(gorp.PostgresDialect); !ok { + return errors.New("only postgres backend supported for multi server configurations") + } kRepo, err := db.NewPrivateKeySetRepo(dbc, cfg.UseOldFormat, cfg.KeySecrets...) if err != nil {