package main /* Healthcheck - Basic HTTP healthcheck system with email notifications Copyright (C) 2024 Yerik K. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ import ( "fmt" "github.com/joho/godotenv" "log" "net/http" ) func main() { fmt.Println("Healthcheck Copyright (C) 2024 Yerik K.\n This program comes with ABSOLUTELY NO WARRANTY.\n This is free software, and you are welcome to redistribute it\n under certain conditions.") err := godotenv.Load() if err != nil { log.Println("Error loading .env file, ignoring") } initDB() defer db.Close() go startHealthCheckTask() go taskStatusChangeNotifier() http.HandleFunc("/api/healthcheck", healthCheckHandler) http.HandleFunc("/api/status", statusHandler) http.HandleFunc("/api/news/", newsHandler) fs := http.FileServer(http.Dir("./public")) http.Handle("/", fs) log.Printf("Listening on port 9000") log.Fatal(http.ListenAndServe(":9000", nil)) }