service context

This commit is contained in:
Elio Bischof 2024-12-04 13:42:23 +01:00
parent 0d44a1b1df
commit 70e49c7e4c
No known key found for this signature in database
GPG Key ID: 7B383FDE4DDBF1BD
6 changed files with 41 additions and 2 deletions

View File

@ -7,6 +7,7 @@ import (
"github.com/spf13/viper"
"github.com/zitadel/logging"
"github.com/zitadel/zitadel/cmd/build"
"github.com/zitadel/zitadel/internal/database"
"github.com/zitadel/zitadel/internal/id"
)
@ -27,6 +28,11 @@ func MustNewConfig(v *viper.Viper) *Config {
)
logging.OnError(err).Fatal("unable to read config")
config.Log.Formatter.Data = map[string]interface{}{
"service": "zitadel",
"version": build.Version(),
}
slog.SetDefault(config.Log.Slog())
id.Configure(config.Machine)

View File

@ -9,6 +9,7 @@ import (
"github.com/spf13/viper"
"github.com/zitadel/logging"
"github.com/zitadel/zitadel/cmd/build"
"github.com/zitadel/zitadel/cmd/hooks"
"github.com/zitadel/zitadel/internal/actions"
internal_authz "github.com/zitadel/zitadel/internal/api/authz"
@ -38,6 +39,11 @@ func mustNewMigrationConfig(v *viper.Viper) *Migration {
config := new(Migration)
mustNewConfig(v, config)
config.Log.Formatter.Data = map[string]interface{}{
"service": "zitadel",
"version": build.Version(),
}
slog.SetDefault(config.Log.Slog())
id.Configure(config.Machine)
@ -49,6 +55,11 @@ func mustNewProjectionsConfig(v *viper.Viper) *ProjectionsConfig {
config := new(ProjectionsConfig)
mustNewConfig(v, config)
config.Log.Formatter.Data = map[string]interface{}{
"service": "zitadel",
"version": build.Version(),
}
slog.SetDefault(config.Log.Slog())
id.Configure(config.Machine)

View File

@ -8,6 +8,7 @@ import (
"github.com/spf13/viper"
"github.com/zitadel/logging"
"github.com/zitadel/zitadel/cmd/build"
internal_authz "github.com/zitadel/zitadel/internal/api/authz"
"github.com/zitadel/zitadel/internal/config/hook"
"github.com/zitadel/zitadel/internal/config/network"
@ -33,6 +34,11 @@ func MustNewConfig(v *viper.Viper) *Config {
)
logging.OnError(err).Fatal("unable to read default config")
config.Log.Formatter.Data = map[string]interface{}{
"service": "zitadel",
"version": build.Version(),
}
slog.SetDefault(config.Log.Slog())
return config

View File

@ -10,6 +10,7 @@ import (
"github.com/spf13/viper"
"github.com/zitadel/logging"
"github.com/zitadel/zitadel/cmd/build"
"github.com/zitadel/zitadel/cmd/encryption"
"github.com/zitadel/zitadel/cmd/hooks"
"github.com/zitadel/zitadel/internal/actions"
@ -83,6 +84,11 @@ func MustNewConfig(v *viper.Viper) *Config {
)
logging.OnError(err).Fatal("unable to read default config")
config.Log.Formatter.Data = map[string]interface{}{
"service": "zitadel",
"version": build.Version(),
}
slog.SetDefault(config.Log.Slog())
id.Configure(config.Machine)

View File

@ -8,6 +8,7 @@ import (
"github.com/spf13/viper"
"github.com/zitadel/logging"
"github.com/zitadel/zitadel/cmd/build"
"github.com/zitadel/zitadel/cmd/encryption"
"github.com/zitadel/zitadel/cmd/hooks"
"github.com/zitadel/zitadel/internal/actions"
@ -111,6 +112,11 @@ func MustNewConfig(v *viper.Viper) *Config {
)
logging.OnError(err).Fatal("unable to read config")
config.Log.Formatter.Data = map[string]interface{}{
"service": "zitadel",
"version": build.Version(),
}
slog.SetDefault(config.Log.Slog())
err = config.Tracing.NewTracer()

View File

@ -9,6 +9,8 @@ import (
"github.com/zitadel/logging"
"sigs.k8s.io/yaml"
"github.com/zitadel/zitadel/cmd/build"
)
type Config struct {
@ -47,8 +49,10 @@ func init() {
if err := yaml.Unmarshal(clientYAML, &loadedConfig); err != nil {
panic(err)
}
if err := loadedConfig.Log.SetLogger(); err != nil {
panic(err)
loadedConfig.Log.Formatter.Data = map[string]interface{}{
"service": "zitadel",
"version": build.Version(),
}
slog.SetDefault(loadedConfig.Log.Slog())