Skip to content

Commit 3e8907b

Browse files
author
Eric Chiang
committed
*: add sql storage options to dex application
1 parent 877eb3d commit 3e8907b

File tree

3 files changed

+17
-2
lines changed

3 files changed

+17
-2
lines changed

cmd/dex/config.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import (
1212
"github.com/coreos/dex/storage"
1313
"github.com/coreos/dex/storage/kubernetes"
1414
"github.com/coreos/dex/storage/memory"
15+
"github.com/coreos/dex/storage/sql"
1516
)
1617

1718
// Config is the config format for the main application.
@@ -71,6 +72,18 @@ func (s *Storage) UnmarshalYAML(unmarshal func(interface{}) error) error {
7172
}
7273
err = unmarshal(&config)
7374
s.Config = &config.Config
75+
case "sqlite3":
76+
var config struct {
77+
Config sql.SQLite3 `yaml:"config"`
78+
}
79+
err = unmarshal(&config)
80+
s.Config = &config.Config
81+
case "postgres":
82+
var config struct {
83+
Config sql.Postgres `yaml:"config"`
84+
}
85+
err = unmarshal(&config)
86+
s.Config = &config.Config
7487
default:
7588
return fmt.Errorf("unknown storage type %q", storageMeta.Type)
7689
}

examples/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
*.db

examples/config-dev.yaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
issuer: http://127.0.0.1:5556
22
storage:
3-
# NOTE(ericchiang): This will be replaced by sqlite3 in the future.
4-
type: memory
3+
type: sqlite3
4+
config:
5+
file: examples/dex.db
56

67
web:
78
http: 127.0.0.1:5556

0 commit comments

Comments
 (0)