feat: add ability to delay startup (#631)

* Feat: add ability to delay startup

* Enable ability to set delay seconds before start up gatus

* Update README.md

* Delete .examples/delay-startup/Makefile

---------

Co-authored-by: TwiN <twin@linux.com>
This commit is contained in:
I-HSIN Cheng
2023-12-25 09:48:43 +08:00
committed by GitHub
parent 3c246f0c69
commit 1e82d2f07d
2 changed files with 10 additions and 0 deletions

View File

@ -4,6 +4,7 @@ import (
"log"
"os"
"os/signal"
"strconv"
"syscall"
"time"
@ -14,6 +15,10 @@ import (
)
func main() {
if delayInSeconds, _ := strconv.Atoi(os.Getenv("GATUS_DELAY_START_SECONDS")); delayInSeconds > 0 {
log.Printf("Delaying start by %d seconds", delayInSeconds)
time.Sleep(time.Duration(delayInSeconds) * time.Second)
}
cfg, err := loadConfiguration()
if err != nil {
panic(err)