From bd4f1efc048d91d5f65c7d5bd95e5c528542f2ed Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 5 Feb 2026 14:20:51 +0000 Subject: [PATCH 1/3] Initial plan From 334de1c4d5b8ad1f7695facf1723d432a2f0e8de Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 5 Feb 2026 14:27:31 +0000 Subject: [PATCH 2/3] Add configuration logging on server startup Co-authored-by: slhmy <31381093+slhmy@users.noreply.github.com> --- .../infrastructure/bootstrap/config_log.go | 44 +++++++++++++++++++ internal/infrastructure/bootstrap/init.go | 2 + 2 files changed, 46 insertions(+) create mode 100644 internal/infrastructure/bootstrap/config_log.go diff --git a/internal/infrastructure/bootstrap/config_log.go b/internal/infrastructure/bootstrap/config_log.go new file mode 100644 index 0000000..1b86d92 --- /dev/null +++ b/internal/infrastructure/bootstrap/config_log.go @@ -0,0 +1,44 @@ +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 + if cmdName == "grpc" { + logGRPCConfig() + } else if cmdName == "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"), + ) +} diff --git a/internal/infrastructure/bootstrap/init.go b/internal/infrastructure/bootstrap/init.go index af58df2..e39681d 100644 --- a/internal/infrastructure/bootstrap/init.go +++ b/internal/infrastructure/bootstrap/init.go @@ -27,6 +27,7 @@ func Init(cmd string) { workdir, _ := os.Getwd() initConfig(path.Join(workdir, "configs")) initLog() + logConfig() slog.Info("APP initialized") } @@ -39,5 +40,6 @@ func InitWithConfigPath(cmd string, configPath string) { } initConfig(configPath) initLog() + logConfig() slog.Info("APP initialized") } From 9899758b7ea4eee6fb3283db238145e658294058 Mon Sep 17 00:00:00 2001 From: slhmy Date: Fri, 6 Feb 2026 21:50:20 +0800 Subject: [PATCH 3/3] Refactor logConfig function to use switch statement for command handling --- internal/infrastructure/bootstrap/config_log.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/internal/infrastructure/bootstrap/config_log.go b/internal/infrastructure/bootstrap/config_log.go index 1b86d92..17ceb0e 100644 --- a/internal/infrastructure/bootstrap/config_log.go +++ b/internal/infrastructure/bootstrap/config_log.go @@ -14,9 +14,10 @@ func logConfig() { ) // Log server configuration based on the command - if cmdName == "grpc" { + switch cmdName { + case "grpc": logGRPCConfig() - } else if cmdName == "gateway" { + case "gateway": logGatewayConfig() } }