sharpen eventhistory service

Signed-off-by: jkoberg <jkoberg@owncloud.com>
This commit is contained in:
jkoberg
2023-02-06 13:08:55 +01:00
parent 5aa1f6eb55
commit c9dfb778a9
20 changed files with 310 additions and 48 deletions

View File

@@ -1,6 +1,8 @@
package defaults
import (
"time"
"github.com/owncloud/ocis/v2/ocis-pkg/shared"
"github.com/owncloud/ocis/v2/services/eventhistory/pkg/config"
)
@@ -19,6 +21,19 @@ func DefaultConfig() *config.Config {
Service: config.Service{
Name: "eventhistory",
},
Events: config.Events{
Endpoint: "127.0.0.1:9233",
Cluster: "ocis-cluster",
EnableTLS: false,
},
Store: config.Store{
Type: "mem",
RecordExpiry: 336 * time.Hour,
},
GRPC: config.GRPCConfig{
Addr: "127.0.0.1:0",
Namespace: "com.owncloud.api",
},
}
}
@@ -42,6 +57,15 @@ func EnsureDefaults(cfg *config.Config) {
cfg.GRPCClientTLS = cfg.Commons.GRPCClientTLS
}
}
if cfg.GRPC.TLS == nil {
cfg.GRPC.TLS = &shared.GRPCServiceTLS{}
if cfg.Commons != nil && cfg.Commons.GRPCServiceTLS != nil {
cfg.GRPC.TLS.Enabled = cfg.Commons.GRPCServiceTLS.Enabled
cfg.GRPC.TLS.Cert = cfg.Commons.GRPCServiceTLS.Cert
cfg.GRPC.TLS.Key = cfg.Commons.GRPCServiceTLS.Key
}
}
}
// Sanitize sanitizes the config