Compare commits

..

3 commits

Author SHA1 Message Date
9b84dea234 fix: correct ci definition for woodpecker
Some checks failed
ci/woodpecker/push/deploy unknown status
ci/woodpecker/push/test Pipeline failed
2023-10-22 14:18:01 +02:00
b87a1cfbea chore: add vscode to gitignore 2023-10-22 14:09:44 +02:00
39ed7aa07f chore: drop drone support 2023-10-22 11:10:23 +02:00
2 changed files with 11 additions and 57 deletions

View file

@ -40,18 +40,11 @@ const (
ModeNet
)
type BackendConfigType string
const (
Memory BackendConfigType = "memory"
SQLite BackendConfigType = "sqlite"
)
type BackendConfig struct {
Config *oidc.Config `json:"config"`
Name string `json:"name"`
ID string `json:"ID"`
Type BackendConfigType `json:"type"`
Type string `json:"type"`
Local bool `json:"local"`
}
@ -61,19 +54,6 @@ type OpenConnectConfig struct {
Issuer string `json:"issuer"`
}
type StorageConfig struct {
File string `json:"file"`
Host string `json:"host"`
Port int `json:"port"`
Database string `json:"database"`
User string `json:"user"`
Password string `json:"password"`
Ssl struct {
Mode string `json:"mode"`
CaFile string `json:"caFile"`
} `json:"ssl"`
}
type jsonConf struct {
Log struct {
Level string `json:"level"`
@ -84,10 +64,6 @@ type jsonConf struct {
Mode string `json:"mode"`
SockPath string `json:"sock"`
} `json:"server"`
Storage struct {
StorageType string `json:"type"`
Config *StorageConfig `json:"config"`
} `json:"storage"`
OpenConnectConfig *OpenConnectConfig `json:"openconnect"`
}
@ -97,8 +73,6 @@ type AppConfig struct {
Host string
Port int
SockPath string
StorageType string
StorageConfig *StorageConfig
OpenConnectConfig *OpenConnectConfig
}
@ -128,8 +102,6 @@ func (ac *AppConfig) UnmarshalJSON(data []byte) error {
ac.Host = jsonConf.Server.Host
ac.Port = jsonConf.Server.Port
ac.OpenConnectConfig = jsonConf.OpenConnectConfig
ac.StorageType = jsonConf.Storage.StorageType
ac.StorageConfig = jsonConf.Storage.Config
return nil
}
@ -138,7 +110,6 @@ var defaultConfig AppConfig = AppConfig{
ServerMode: ModeNet,
Host: "0.0.0.0",
Port: 5000,
StorageType: "memory",
}
func New(filepath string) (*AppConfig, error) {

View file

@ -4,7 +4,6 @@ import (
"context"
"encoding/json"
"flag"
"fmt"
"os"
"os/signal"
"time"
@ -35,17 +34,6 @@ func parseArgs() *cliArgs {
}
}
func initStorage(conf *config.AppConfig) (storage.Storage, error) {
var storageType storage.Storage
switch conf.StorageType {
case "memory":
storageType = memory.New(logger.L)
default:
return storageType, fmt.Errorf("unsupported storage backend type: %s", conf.StorageType)
}
return storageType, nil
}
func main() {
args := parseArgs()
@ -59,17 +47,12 @@ func main() {
logger.Init(conf.LogLevel)
logger.L.Infof("Initialized logger with level %v", conf.LogLevel)
storageType, err := initStorage(conf)
if err != nil {
logger.L.Fatalf("Failed to initialize storage backend: %s", err.Error())
}
logger.L.Infof("Initialized storage backend %q", conf.StorageType)
dexConf := dex_server.Config{
Web: dex_server.WebConfig{
Dir: "./",
Theme: "default",
},
Storage: storageType,
Storage: memory.New(logger.L),
Issuer: conf.OpenConnectConfig.Issuer,
SupportedResponseTypes: []string{"code"},
SkipApprovalScreen: false,
@ -99,7 +82,7 @@ func main() {
if err := dexConf.Storage.CreateConnector(storage.Connector{
ID: backend.ID,
Name: backend.Name,
Type: string(backend.Type),
Type: backend.Type,
Config: backendConfJson,
}); err != nil {
logger.L.Errorf("Failed to add connector for backend %q to stage: %s", backend.Name, err.Error())