feat: add version and protocol version
- define GoTomatoVersion constant for versioning
- add protocol version field to all server messages
- add `-version` cli parameter
- update README
🤖
This commit is contained in:
parent
4eedfcb965
commit
232fe409cb
4 changed files with 23 additions and 7 deletions
|
@ -3,11 +3,14 @@ package server
|
|||
import (
|
||||
"flag"
|
||||
"fmt"
|
||||
"git.smsvc.net/pomodoro/GoTomato/internal/metadata"
|
||||
"git.smsvc.net/pomodoro/GoTomato/internal/shared"
|
||||
"git.smsvc.net/pomodoro/GoTomato/internal/websocket"
|
||||
"git.smsvc.net/pomodoro/GoTomato/pkg/models"
|
||||
"log"
|
||||
"net/http"
|
||||
"os"
|
||||
"strings"
|
||||
)
|
||||
|
||||
func Start() {
|
||||
|
@ -15,8 +18,16 @@ func Start() {
|
|||
listenAddress := flag.String("listenAddress", shared.DefaultServerConfig.ListenAddress, "IP address to listen on")
|
||||
listenPort := flag.Int("listenPort", shared.DefaultServerConfig.ListenPort, "Port to listen on")
|
||||
password := flag.String("password", "", "Control password for pomodoro session (optional)")
|
||||
showVersionFlag := flag.Bool("version", false, "Output version")
|
||||
flag.Parse()
|
||||
|
||||
shared.Message.GoTomatoVersion = strings.Split(metadata.GoTomatoVersion, ".")[0]
|
||||
if *showVersionFlag {
|
||||
fmt.Printf("App-Version: %s\n", metadata.GoTomatoVersion)
|
||||
fmt.Printf("Protocol-Version: %s\n", shared.Message.GoTomatoVersion)
|
||||
os.Exit(0)
|
||||
}
|
||||
|
||||
serverConfig := models.GoTomatoServerConfig{
|
||||
ListenAddress: *listenAddress,
|
||||
ListenPort: *listenPort,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue