Skip to content

Commit e003bf7

Browse files
committed
Make the logs minimal
1 parent baf6981 commit e003bf7

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

cmd/git-remote-gitopia/gitopia.go

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,20 +55,34 @@ type GitopiaHandler struct {
5555
func (h *GitopiaHandler) Initialize(remote *core.Remote) error {
5656
var err error
5757

58+
// Check existing configuration
5859
grpcHost, _ := config.GitConfigGet(config.GitopiaConfigGRPCHostOption)
5960
tmAddr, _ := config.GitConfigGet(config.GitopiaConfigTmAddrOption)
61+
62+
// Validate and configure gRPC and RPC hosts
63+
needsReconfiguration := false
6064
if grpcHost == "" || tmAddr == "" || !api.CheckGRPCHostLiveness(grpcHost) || !api.CheckRPCHostLiveness(tmAddr) {
65+
needsReconfiguration = true
66+
}
67+
68+
if needsReconfiguration {
69+
remote.Logger.Printf("Configuring Gitopia hosts...")
6170
provider := api.GetBestApiProvider()
6271
grpcHost = provider.GRPCHost
72+
tmAddr = provider.TMAddr
73+
6374
if err := api.SetConfiguredGRPCHost(provider.GRPCHost); err != nil {
6475
return err
6576
}
77+
6678
if err := api.SetConfiguredTmAddr(provider.TMAddr); err != nil {
6779
return err
6880
}
6981
}
7082

83+
// Check and configure Git server host
7184
gitServerHost, _ := config.GitConfigGet(config.GitopiaConfigGitServerHostOption)
85+
7286
if gitServerHost == "" || !api.CheckGitServerHostLiveness(gitServerHost) {
7387
gitServerHost = api.GetBestGitServerHost(grpcHost)
7488
if gitServerHost != "" {
@@ -78,10 +92,6 @@ func (h *GitopiaHandler) Initialize(remote *core.Remote) error {
7892
}
7993
}
8094

81-
remote.Logger.Printf("grpc host: %s", grpcHost)
82-
remote.Logger.Printf("rpc host: %s", tmAddr)
83-
remote.Logger.Printf("git server host: %s", gitServerHost)
84-
8595
h.grpcConn, err = grpc.Dial(grpcHost, grpc.WithTransportCredentials(insecure.NewCredentials()))
8696
if err != nil {
8797
return err

0 commit comments

Comments
 (0)