This commit is contained in:
parent
e75a4d4607
commit
4507728dae
32 changed files with 725 additions and 551 deletions
|
@ -7,6 +7,8 @@ import (
|
|||
"io/fs"
|
||||
"os"
|
||||
|
||||
"github.com/dexidp/dex/connector/oidc"
|
||||
"github.com/dexidp/dex/storage"
|
||||
"github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
|
@ -38,6 +40,19 @@ const (
|
|||
ModeNet
|
||||
)
|
||||
|
||||
type BackendConfig struct {
|
||||
Config *oidc.Config `json:"config"`
|
||||
Name string `json:"name"`
|
||||
ID string `json:"ID"`
|
||||
Type string `json:"type"`
|
||||
Local bool `json:"local"`
|
||||
}
|
||||
|
||||
type OpenConnectConfig struct {
|
||||
ClientConfigs []*storage.Client `json:"clients"`
|
||||
BackendConfigs []*BackendConfig `json:"backends"`
|
||||
}
|
||||
|
||||
type jsonConf struct {
|
||||
Log struct {
|
||||
Level string `json:"level"`
|
||||
|
@ -48,14 +63,16 @@ type jsonConf struct {
|
|||
Mode string `json:"mode"`
|
||||
SockPath string `json:"sock"`
|
||||
} `json:"server"`
|
||||
OpenConnectConfig *OpenConnectConfig `json:"openconnect"`
|
||||
}
|
||||
|
||||
type AppConfig struct {
|
||||
LogLevel logrus.Level
|
||||
ServerMode ListeningMode
|
||||
Host string
|
||||
Port int
|
||||
SockPath string
|
||||
LogLevel logrus.Level
|
||||
ServerMode ListeningMode
|
||||
Host string
|
||||
Port int
|
||||
SockPath string
|
||||
OpenConnectConfig *OpenConnectConfig
|
||||
}
|
||||
|
||||
func parseLevel(lvlStr string) logrus.Level {
|
||||
|
@ -78,10 +95,13 @@ func (ac *AppConfig) UnmarshalJSON(data []byte) error {
|
|||
if err != nil {
|
||||
return fmt.Errorf("failed to parse server listening mode: %w", err)
|
||||
}
|
||||
|
||||
fmt.Println(jsonConf)
|
||||
ac.ServerMode = lm
|
||||
ac.SockPath = jsonConf.Server.SockPath
|
||||
ac.Host = jsonConf.Server.Host
|
||||
ac.Port = jsonConf.Server.Port
|
||||
ac.OpenConnectConfig = jsonConf.OpenConnectConfig
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue