@@ -98,21 +98,27 @@ func main() {
9898
9999func _main (ctx context.Context , reader * reader.Reader , args []string , logger log.LoggerInterface ,
100100 buildInfo models.BuildInformation , timeNow func () time.Time ) (err error ) {
101- if health .IsClientMode (args ) {
102- // Running the program in a separate instance through the Docker
103- // built-in healthcheck, in an ephemeral fashion to query the
104- // long running instance of the program about its status
105-
106- var healthSettings config.Health
107- healthSettings .Read (reader )
108- healthSettings .SetDefaults ()
109- err = healthSettings .Validate ()
110- if err != nil {
111- return fmt .Errorf ("health settings: %w" , err )
101+ if len (args ) > 1 {
102+ switch args [1 ] {
103+ case "version" , "-version" , "--version" :
104+ fmt .Println (buildInfo .VersionString ())
105+ return nil
106+ case "healthcheck" :
107+ // Running the program in a separate instance through the Docker
108+ // built-in healthcheck, in an ephemeral fashion to query the
109+ // long running instance of the program about its status
110+
111+ var healthSettings config.Health
112+ healthSettings .Read (reader )
113+ healthSettings .SetDefaults ()
114+ err = healthSettings .Validate ()
115+ if err != nil {
116+ return fmt .Errorf ("health settings: %w" , err )
117+ }
118+
119+ client := health .NewClient ()
120+ return client .Query (ctx , * healthSettings .ServerAddress )
112121 }
113-
114- client := health .NewClient ()
115- return client .Query (ctx , * healthSettings .ServerAddress )
116122 }
117123
118124 announcementExp , err := time .Parse (time .RFC3339 , "2023-07-15T00:00:00Z" )
0 commit comments