add healthcheck route
This commit is contained in:
@@ -7,6 +7,7 @@ import (
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"gitea.local.lab/Lbenedar/foundry_helper_service/internal/foundry/actions"
|
||||
"gitea.local.lab/Lbenedar/foundry_helper_service/internal/foundry/transport"
|
||||
"gitea.local.lab/Lbenedar/foundry_helper_service/internal/foundry/types"
|
||||
)
|
||||
@@ -73,21 +74,21 @@ func (foundry *FoundryApi) ServeWebSocket() error {
|
||||
}
|
||||
case types.RespServerChangeCode:
|
||||
foundry.IsAvailable = true
|
||||
// data, err := actions.SplitToTypeAndData([]byte(message.MsgJson))
|
||||
// if err != nil {
|
||||
// wsChannels.Err() <- &types.FoundryError{Direction: types.ReaderCode, Err: err, Type: types.WebSocketCode}
|
||||
// continue
|
||||
// }
|
||||
data, err := actions.SplitToTypeAndData([]byte(message.MsgJson))
|
||||
if err != nil {
|
||||
wsChannels.Err() <- &types.FoundryError{Direction: types.ReaderCode, Err: err, Type: types.WebSocketCode}
|
||||
continue
|
||||
}
|
||||
|
||||
// if data == nil {
|
||||
// continue
|
||||
// }
|
||||
if data == nil {
|
||||
continue
|
||||
}
|
||||
|
||||
// err = data.Action(foundry.transport, &foundry.Status)
|
||||
// if err != nil {
|
||||
// wsChannels.Err() <- &types.FoundryError{Direction: types.ReaderCode, Err: err, Type: types.WebSocketCode}
|
||||
// continue
|
||||
// }
|
||||
err = data.Action(foundry.transport, &foundry.Status)
|
||||
if err != nil {
|
||||
wsChannels.Err() <- &types.FoundryError{Direction: types.ReaderCode, Err: err, Type: types.WebSocketCode}
|
||||
continue
|
||||
}
|
||||
case types.RespDataCode:
|
||||
foundry.transport.ExchangeChan.Msgs[message.Id] = make(chan []byte, 1)
|
||||
foundry.transport.ExchangeChan.Msgs[message.Id] <- []byte(message.MsgJson)
|
||||
|
||||
@@ -3,13 +3,13 @@ package types
|
||||
import "gitea.local.lab/Lbenedar/foundry_helper_service/internal/foundry/models/json"
|
||||
|
||||
type FoundryStatus struct {
|
||||
IsActive bool
|
||||
Version string
|
||||
World string
|
||||
System string
|
||||
SystemVersion string
|
||||
Users int
|
||||
Uptime int64
|
||||
IsActive bool `json:"on_world"`
|
||||
Version string `json:"version"`
|
||||
World string `json:"world,omitempty"`
|
||||
System string `json:"system,omitempty"`
|
||||
SystemVersion string `json:"-"`
|
||||
Users int `json:"-"`
|
||||
Uptime int64 `json:"-"`
|
||||
}
|
||||
|
||||
func NewFoundryStatus(status *json.Status) *FoundryStatus {
|
||||
|
||||
Reference in New Issue
Block a user