From 3e8907b8185f385d8dca258c06c07c695205fa3e Mon Sep 17 00:00:00 2001 From: Eric Chiang Date: Mon, 3 Oct 2016 12:46:49 -0700 Subject: [PATCH] *: add sql storage options to dex application --- cmd/dex/config.go | 13 +++++++++++++ examples/.gitignore | 1 + examples/config-dev.yaml | 5 +++-- 3 files changed, 17 insertions(+), 2 deletions(-) create mode 100644 examples/.gitignore diff --git a/cmd/dex/config.go b/cmd/dex/config.go index 2b08885d..b28733ec 100644 --- a/cmd/dex/config.go +++ b/cmd/dex/config.go @@ -12,6 +12,7 @@ import ( "github.com/coreos/dex/storage" "github.com/coreos/dex/storage/kubernetes" "github.com/coreos/dex/storage/memory" + "github.com/coreos/dex/storage/sql" ) // Config is the config format for the main application. @@ -71,6 +72,18 @@ func (s *Storage) UnmarshalYAML(unmarshal func(interface{}) error) error { } err = unmarshal(&config) s.Config = &config.Config + case "sqlite3": + var config struct { + Config sql.SQLite3 `yaml:"config"` + } + err = unmarshal(&config) + s.Config = &config.Config + case "postgres": + var config struct { + Config sql.Postgres `yaml:"config"` + } + err = unmarshal(&config) + s.Config = &config.Config default: return fmt.Errorf("unknown storage type %q", storageMeta.Type) } diff --git a/examples/.gitignore b/examples/.gitignore new file mode 100644 index 00000000..98e6ef67 --- /dev/null +++ b/examples/.gitignore @@ -0,0 +1 @@ +*.db diff --git a/examples/config-dev.yaml b/examples/config-dev.yaml index fa61cc5e..2a2736b5 100644 --- a/examples/config-dev.yaml +++ b/examples/config-dev.yaml @@ -1,7 +1,8 @@ issuer: http://127.0.0.1:5556 storage: - # NOTE(ericchiang): This will be replaced by sqlite3 in the future. - type: memory + type: sqlite3 + config: + file: examples/dex.db web: http: 127.0.0.1:5556