Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions internal/infrastructure/bootstrap/config_log.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
package bootstrap

import (
"log/slog"
)

// logConfig logs the key configuration values when the server starts.
// Sensitive values like passwords and secrets are not logged.
func logConfig() {
slog.Info("Configuration loaded",
"mode", mode,
"log.level", config.GetString(configKeyLogLevel),
"log.format", config.GetString(configKeyLogFormat),
)

// Log server configuration based on the command
switch cmdName {
case "grpc":
logGRPCConfig()
case "gateway":
logGatewayConfig()
}
}

func logGRPCConfig() {
slog.Info("gRPC server configuration",
"grpc_port", config.GetUint("grpc_port"),
"persistence.type", config.GetString("persistence.type"),
"persistence.gorm.driver", config.GetString("persistence.gorm.driver"),
"persistence.gorm.dbname", config.GetString("persistence.gorm.dbname"),
"redis.urls", config.GetStringSlice("redis.urls"),
"smtp_mailer.host", config.GetString("smtp_mailer.host"),
"smtp_mailer.port", config.GetInt("smtp_mailer.port"),
"auth.oauth_state_expiration", config.GetString("auth.oauth_state_expiration"),
"auth.access_token_expiration", config.GetString("auth.access_token_expiration"),
"auth.refresh_token_expiration", config.GetString("auth.refresh_token_expiration"),
"auth.token_issuer", config.GetString("auth.token_issuer"),
)
}

func logGatewayConfig() {
slog.Info("Gateway server configuration",
"http_port", config.GetUint("http_port"),
)
}
2 changes: 2 additions & 0 deletions internal/infrastructure/bootstrap/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ func Init(cmd string) {
workdir, _ := os.Getwd()
initConfig(path.Join(workdir, "configs"))
initLog()
logConfig()
slog.Info("APP initialized")
}

Expand All @@ -39,5 +40,6 @@ func InitWithConfigPath(cmd string, configPath string) {
}
initConfig(configPath)
initLog()
logConfig()
slog.Info("APP initialized")
}