mirror of
https://github.com/TwiN/gatus.git
synced 2024-11-21 15:33:17 +01:00
fix(maintenance): Import time/tzdata to support timezones (#849)
Fix #848
This commit is contained in:
parent
d04b68979a
commit
54221eff9b
@ -6,6 +6,7 @@ import (
|
|||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
_ "time/tzdata" // Required for IANA timezone support
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@ -52,7 +53,7 @@ func GetDefaultConfig() *Config {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// IsEnabled returns whether maintenance is enabled or not
|
// IsEnabled returns whether maintenance is enabled or not
|
||||||
func (c Config) IsEnabled() bool {
|
func (c *Config) IsEnabled() bool {
|
||||||
if c.Enabled == nil {
|
if c.Enabled == nil {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
@ -101,7 +102,7 @@ func (c *Config) ValidateAndSetDefaults() error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// IsUnderMaintenance checks whether the endpoints that Gatus monitors are within the configured maintenance window
|
// IsUnderMaintenance checks whether the endpoints that Gatus monitors are within the configured maintenance window
|
||||||
func (c Config) IsUnderMaintenance() bool {
|
func (c *Config) IsUnderMaintenance() bool {
|
||||||
if !c.IsEnabled() {
|
if !c.IsEnabled() {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
@ -127,7 +128,7 @@ func (c Config) IsUnderMaintenance() bool {
|
|||||||
return now.After(startOfMaintenancePeriod) && now.Before(endOfMaintenancePeriod)
|
return now.After(startOfMaintenancePeriod) && now.Before(endOfMaintenancePeriod)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c Config) hasDay(day string) bool {
|
func (c *Config) hasDay(day string) bool {
|
||||||
for _, d := range c.Every {
|
for _, d := range c.Every {
|
||||||
if d == day {
|
if d == day {
|
||||||
return true
|
return true
|
||||||
|
Loading…
Reference in New Issue
Block a user