Skip to content

Commit 1408ccb

Browse files
committed
Add log for consul initialization
1 parent e77315d commit 1408ccb

1 file changed

Lines changed: 14 additions & 1 deletion

File tree

pkg/infra/consul.go

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,21 @@ func GetConsulClient(environment string) *api.Client {
3232

3333
config.Address = viper.GetString("consul.address")
3434
config.WaitTime = 10 * time.Second
35-
// Ping the Consul server to verify connectivity
3635

36+
tokenLength := 0
37+
if config.Token != "" {
38+
tokenLength = len(config.Token)
39+
}
40+
41+
logger.Info("Consul config",
42+
"environment", environment,
43+
"address", config.Address,
44+
"wait_time", config.WaitTime,
45+
"token_length", tokenLength,
46+
"http_auth", config.HttpAuth,
47+
)
48+
49+
// Ping the Consul server to verify connectivity
3750
client, err := api.NewClient(config)
3851
if err != nil {
3952
logger.Fatal("Failed to create consul client", err)

0 commit comments

Comments
 (0)