*: add sql storage options to dex application
This commit is contained in:
parent
877eb3dc7b
commit
3e8907b818
3 changed files with 17 additions and 2 deletions
|
@ -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)
|
||||
}
|
||||
|
|
1
examples/.gitignore
vendored
Normal file
1
examples/.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
*.db
|
|
@ -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
|
||||
|
|
Reference in a new issue