mirror of
https://github.com/zitadel/zitadel.git
synced 2025-05-17 09:18:25 +00:00
Merge branch 'basics' into proto-files
# Conflicts: # cmd/zitadel/main.go # go.sum # pkg/admin/admin.go # pkg/auth/auth.go # pkg/management/management.go
This commit is contained in:
commit
8b23c491f9
@ -22,8 +22,8 @@ type Config struct {
|
|||||||
Admin *admin.Config
|
Admin *admin.Config
|
||||||
Console *console.Config
|
Console *console.Config
|
||||||
|
|
||||||
//Log
|
//Log //TODO: add
|
||||||
//Tracing tracing.TracingConfig
|
//Tracing tracing.TracingConfig //TODO: add
|
||||||
AuthZ *authz.Config
|
AuthZ *authz.Config
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -35,7 +35,6 @@ func main() {
|
|||||||
loginEnabled := flag.Bool("login", true, "enable login ui")
|
loginEnabled := flag.Bool("login", true, "enable login ui")
|
||||||
adminEnabled := flag.Bool("admin", true, "enable admin api")
|
adminEnabled := flag.Bool("admin", true, "enable admin api")
|
||||||
consoleEnabled := flag.Bool("console", true, "enable console ui")
|
consoleEnabled := flag.Bool("console", true, "enable console ui")
|
||||||
|
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
|
|
||||||
conf := new(Config)
|
conf := new(Config)
|
||||||
|
@ -14,7 +14,6 @@ Mgmt:
|
|||||||
GRPC:
|
GRPC:
|
||||||
ServerPort: 60020
|
ServerPort: 60020
|
||||||
GatewayPort: 60021
|
GatewayPort: 60021
|
||||||
SearchLimit: 100
|
|
||||||
CustomHeaders:
|
CustomHeaders:
|
||||||
- x-caos-
|
- x-caos-
|
||||||
|
|
||||||
@ -23,7 +22,6 @@ Auth:
|
|||||||
GRPC:
|
GRPC:
|
||||||
ServerPort: 60050
|
ServerPort: 60050
|
||||||
GatewayPort: 60051
|
GatewayPort: 60051
|
||||||
SearchLimit: 100
|
|
||||||
CustomHeaders:
|
CustomHeaders:
|
||||||
- x-caos-
|
- x-caos-
|
||||||
|
|
||||||
@ -35,7 +33,6 @@ Admin:
|
|||||||
GRPC:
|
GRPC:
|
||||||
ServerPort: 60090
|
ServerPort: 60090
|
||||||
GatewayPort: 60091
|
GatewayPort: 60091
|
||||||
SearchLimit: 100
|
|
||||||
CustomHeaders:
|
CustomHeaders:
|
||||||
- x-caos-
|
- x-caos-
|
||||||
|
|
||||||
|
@ -7,10 +7,6 @@ import (
|
|||||||
"github.com/caos/logging"
|
"github.com/caos/logging"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
|
||||||
HeaderOrgID = "x-caos-zitadel-orgid"
|
|
||||||
)
|
|
||||||
|
|
||||||
type CtxKeyPermissions struct{}
|
type CtxKeyPermissions struct{}
|
||||||
type CtxKeyData struct{}
|
type CtxKeyData struct{}
|
||||||
|
|
||||||
|
@ -3,14 +3,12 @@ package grpc
|
|||||||
type Config struct {
|
type Config struct {
|
||||||
ServerPort string
|
ServerPort string
|
||||||
GatewayPort string
|
GatewayPort string
|
||||||
SearchLimit int
|
|
||||||
CustomHeaders []string
|
CustomHeaders []string
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Config) ToServerConfig() *ServerConfig {
|
func (c *Config) ToServerConfig() *ServerConfig {
|
||||||
return &ServerConfig{
|
return &ServerConfig{
|
||||||
Port: c.ServerPort,
|
Port: c.ServerPort,
|
||||||
SearchLimit: c.SearchLimit,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -24,7 +22,6 @@ func (c *Config) ToGatewayConfig() *GatewayConfig {
|
|||||||
|
|
||||||
type ServerConfig struct {
|
type ServerConfig struct {
|
||||||
Port string
|
Port string
|
||||||
SearchLimit int
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type GatewayConfig struct {
|
type GatewayConfig struct {
|
||||||
|
15
internal/config/types/duration.go
Normal file
15
internal/config/types/duration.go
Normal file
@ -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
|
||||||
|
}
|
46
internal/config/types/duration_test.go
Normal file
46
internal/config/types/duration_test.go
Normal file
@ -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)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user