[check ip addr] make this optional
This commit is contained in:
parent
0d557b3083
commit
b258a3e750
3 changed files with 11 additions and 1 deletions
|
|
@ -2,3 +2,4 @@ DISCORD_TOKEN=""
|
|||
DISCORD_CHANNEL_ID=""
|
||||
CHECK_DOMAINS="[\"google.com\"]"
|
||||
CHECK_NOTIFY_EXPIRATION_DAYS=7
|
||||
CHECK_IP="false"
|
||||
|
|
|
|||
|
|
@ -42,6 +42,10 @@ func RunCheck(config *Config) {
|
|||
}
|
||||
}()
|
||||
|
||||
if !config.CheckIp {
|
||||
continue
|
||||
}
|
||||
|
||||
go func() {
|
||||
defer wg.Done()
|
||||
|
||||
|
|
|
|||
|
|
@ -2,9 +2,12 @@ package src
|
|||
|
||||
import (
|
||||
"encoding/json"
|
||||
"github.com/joho/godotenv"
|
||||
"os"
|
||||
"slices"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"github.com/joho/godotenv"
|
||||
)
|
||||
|
||||
type Config struct {
|
||||
|
|
@ -12,6 +15,7 @@ type Config struct {
|
|||
NotifyExpirationDays int
|
||||
DiscordToken string
|
||||
DiscordChannelID string
|
||||
CheckIp bool
|
||||
}
|
||||
|
||||
func GetConfig() (*Config, error) {
|
||||
|
|
@ -36,5 +40,6 @@ func GetConfig() (*Config, error) {
|
|||
NotifyExpirationDays: notifyExpirationDays,
|
||||
DiscordToken: os.Getenv("DISCORD_TOKEN"),
|
||||
DiscordChannelID: os.Getenv("DISCORD_CHANNEL_ID"),
|
||||
CheckIp: slices.Contains([]string{"true", "1"}, strings.ToLower(os.Getenv("CHECK_IP"))),
|
||||
}, nil
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue