Sebastian Mark
e7618b19ef
- add a function to check if Pomodoro settings are valid
- log a warning for invalid client configurations
- log an info message for valid client configurations
- implement Stringer interface for PomodoroConfig model
🤖
22 lines
806 B
Go
22 lines
806 B
Go
package models
|
|
|
|
import "fmt"
|
|
|
|
// Represents the configuration of a pomodoro
|
|
type PomodoroConfig struct {
|
|
Work int `json:"work"` // Length of work sessions in seconds
|
|
ShortBreak int `json:"shortBreak"` // Length of short break in seconds
|
|
LongBreak int `json:"longBreak"` // Length of long break in seconds
|
|
Sessions int `json:"sessions"` // Number of total sessions
|
|
}
|
|
|
|
// Stringer interface for the PomodocoConfig model
|
|
func (c PomodoroConfig) String() string {
|
|
return fmt.Sprintf("{work: %d, short: %d, long: %d, sessions: %d}", c.Work, c.ShortBreak, c.LongBreak, c.Sessions)
|
|
}
|
|
|
|
// Represents the server configuration
|
|
type ServerConfig struct {
|
|
ListenAddress string `json:"listenAddress"` // Server listen address
|
|
ListenPort int `json:"listenPort"` // Server listen port
|
|
}
|