Skip to content

Commit fb97de6

Browse files
committed
refactor: align inventory and telemetry configs
1 parent 49ad4eb commit fb97de6

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

pkg/telemetry/config.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ const (
66
defaultServiceName = "keep-service"
77
defaultEnvironment = "development"
88
defaultShutdownTimeout = 5 * time.Second
9+
zeroDuration = 0 * time.Second
910
)
1011

1112
// Config controls OpenTelemetry initialization.
@@ -25,7 +26,7 @@ func (c *Config) defaults() {
2526
if c.Environment == "" {
2627
c.Environment = defaultEnvironment
2728
}
28-
if c.ShutdownTimeout == 0 {
29+
if c.ShutdownTimeout == zeroDuration {
2930
c.ShutdownTimeout = defaultShutdownTimeout
3031
}
3132
}

services/inventory/server/server.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,9 @@ type Config struct {
5252
}
5353

5454
type Server struct {
55-
cfg Config
5655
db *sql.DB
5756
http *http.Server
57+
cfg Config
5858
}
5959

6060
func NewServer(cfg Config) (*Server, error) {
@@ -244,11 +244,11 @@ func (s *Server) updateDevicePosture(w http.ResponseWriter, r *http.Request) {
244244
}
245245

246246
type Device struct {
247+
Registered time.Time `json:"registered_at"`
248+
LastUpdated time.Time `json:"last_updated"`
247249
ID string `json:"id"`
248250
PublicKey string `json:"public_key"`
249251
Posture string `json:"posture"`
250-
Registered time.Time `json:"registered_at"`
251-
LastUpdated time.Time `json:"last_updated"`
252252
}
253253

254254
func (s *Server) listDevices(w http.ResponseWriter, _ *http.Request) {

0 commit comments

Comments
 (0)