diff --git a/cmd/zitadel/main.go b/cmd/zitadel/main.go index 4c3137b9c..e56940361 100644 --- a/cmd/zitadel/main.go +++ b/cmd/zitadel/main.go @@ -22,8 +22,8 @@ type Config struct { Admin *admin.Config Console *console.Config - //Log - //Tracing tracing.TracingConfig + //Log //TODO: add + //Tracing tracing.TracingConfig //TODO: add AuthZ *authz.Config } @@ -35,7 +35,6 @@ func main() { loginEnabled := flag.Bool("login", true, "enable login ui") adminEnabled := flag.Bool("admin", true, "enable admin api") consoleEnabled := flag.Bool("console", true, "enable console ui") - flag.Parse() conf := new(Config) diff --git a/cmd/zitadel/startup.yaml b/cmd/zitadel/startup.yaml index 265ad4908..9a8a4bce6 100644 --- a/cmd/zitadel/startup.yaml +++ b/cmd/zitadel/startup.yaml @@ -14,7 +14,6 @@ Mgmt: GRPC: ServerPort: 60020 GatewayPort: 60021 - SearchLimit: 100 CustomHeaders: - x-caos- @@ -23,7 +22,6 @@ Auth: GRPC: ServerPort: 60050 GatewayPort: 60051 - SearchLimit: 100 CustomHeaders: - x-caos- @@ -35,7 +33,6 @@ Admin: GRPC: ServerPort: 60090 GatewayPort: 60091 - SearchLimit: 100 CustomHeaders: - x-caos- diff --git a/internal/api/auth/context.go b/internal/api/auth/context.go index 5638fa40d..b17affec2 100644 --- a/internal/api/auth/context.go +++ b/internal/api/auth/context.go @@ -7,10 +7,6 @@ import ( "github.com/caos/logging" ) -const ( - HeaderOrgID = "x-caos-zitadel-orgid" -) - type CtxKeyPermissions struct{} type CtxKeyData struct{} diff --git a/internal/api/grpc/config.go b/internal/api/grpc/config.go index 4895fda7e..1b3179d5a 100644 --- a/internal/api/grpc/config.go +++ b/internal/api/grpc/config.go @@ -3,14 +3,12 @@ package grpc type Config struct { ServerPort string GatewayPort string - SearchLimit int CustomHeaders []string } func (c *Config) ToServerConfig() *ServerConfig { return &ServerConfig{ - Port: c.ServerPort, - SearchLimit: c.SearchLimit, + Port: c.ServerPort, } } @@ -23,8 +21,7 @@ func (c *Config) ToGatewayConfig() *GatewayConfig { } type ServerConfig struct { - Port string - SearchLimit int + Port string } type GatewayConfig struct { diff --git a/internal/config/flag.go b/internal/config/array_flag.go similarity index 100% rename from internal/config/flag.go rename to internal/config/array_flag.go diff --git a/internal/config/types/duration.go b/internal/config/types/duration.go new file mode 100644 index 000000000..6413aea83 --- /dev/null +++ b/internal/config/types/duration.go @@ -0,0 +1,15 @@ +package types + +import ( + "time" +) + +type Duration struct { + time.Duration +} + +func (d *Duration) UnmarshalText(data []byte) error { + var err error + d.Duration, err = time.ParseDuration(string(data)) + return err +} diff --git a/internal/config/types/duration_test.go b/internal/config/types/duration_test.go new file mode 100644 index 000000000..8058d07a4 --- /dev/null +++ b/internal/config/types/duration_test.go @@ -0,0 +1,46 @@ +package types + +import ( + "testing" + "time" +) + +func TestDuration_UnmarshalText(t *testing.T) { + type args struct { + data []byte + } + tests := []struct { + name string + args args + wantErr bool + want time.Duration + }{ + { + "ok", + args{ + data: []byte("10s"), + }, + false, + time.Duration(10 * time.Second), + }, + { + "error", + args{ + data: []byte("10"), + }, + true, + time.Duration(0), + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + d := &Duration{} + if err := d.UnmarshalText(tt.args.data); (err != nil) != tt.wantErr { + t.Errorf("UnmarshalText() error = %v, wantErr %v", err, tt.wantErr) + } + if d.Duration != tt.want { + t.Errorf("UnmarshalText() got = %v, want %v", d.Duration, tt.want) + } + }) + } +}