@@ -21,7 +21,7 @@ import (
2121var (
2222 RunOnce bool
2323 InitialRunFinished atomic.Bool
24- HealthCheckAddr = ":8087"
24+ StatusAddr = ":8087"
2525
2626 metricsSyncTime = prometheus .NewGauge (prometheus.GaugeOpts {
2727 Namespace : "objinsync" ,
@@ -46,7 +46,7 @@ func healthCheckHandler(w http.ResponseWriter, r *http.Request) {
4646func serveHealthCheckEndpoints () {
4747 http .HandleFunc ("/health" , healthCheckHandler )
4848 http .Handle ("/metrics" , promhttp .Handler ())
49- log .Fatal (http .ListenAndServe (HealthCheckAddr , nil ))
49+ log .Fatal (http .ListenAndServe (StatusAddr , nil ))
5050}
5151
5252func main () {
@@ -77,7 +77,7 @@ func main() {
7777 }()
7878 }
7979 } else {
80- l .Warnf ("SENTRY_DSN not found, skipped Sentry setup ." )
80+ l .Infof ("SENTRY_DSN not found, sentry integration disabled ." )
8181 }
8282
8383 var rootCmd = & cobra.Command {
@@ -108,7 +108,8 @@ func main() {
108108 if errMsg != "" {
109109 sentry .CaptureMessage (errMsg )
110110 sentry .Flush (time .Second * 5 )
111- l .Fatalf (errMsg )
111+ fmt .Println ("ERROR: failed to pull objects from remote store:" , errMsg )
112+ os .Exit (1 )
112113 }
113114
114115 syncTime := time .Now ().Sub (start )
@@ -122,7 +123,7 @@ func main() {
122123 } else {
123124 InitialRunFinished .Store (false )
124125 go serveHealthCheckEndpoints ()
125- l .Infof ("Serving health check endpoints at: %s." , HealthCheckAddr )
126+ l .Infof ("Serving health check endpoints at: %s." , StatusAddr )
126127 l .Infof ("Pulling from %s to %s every %v..." , remoteUri , localDir , interval )
127128 ticker := time .NewTicker (interval )
128129 pull ()
@@ -137,6 +138,7 @@ func main() {
137138 },
138139 }
139140 pullCmd .PersistentFlags ().BoolVarP (& RunOnce , "once" , "o" , false , "run action once and then exit." )
141+ pullCmd .PersistentFlags ().StringVarP (& StatusAddr , "status-addr" , "s" , ":8087" , "binding address for status endpoint." )
140142
141143 rootCmd .AddCommand (pullCmd )
142144 rootCmd .Execute ()
0 commit comments