diff --git a/env.template b/env.template index c39597b..4ee2143 100644 --- a/env.template +++ b/env.template @@ -2,3 +2,4 @@ DISCORD_TOKEN="" DISCORD_CHANNEL_ID="" CHECK_DOMAINS="[\"google.com\"]" CHECK_NOTIFY_EXPIRATION_DAYS=7 +CHECK_IP="false" diff --git a/src/checker.go b/src/checker.go index 77fb852..7104e86 100644 --- a/src/checker.go +++ b/src/checker.go @@ -42,6 +42,10 @@ func RunCheck(config *Config) { } }() + if !config.CheckIp { + continue + } + go func() { defer wg.Done() diff --git a/src/config.go b/src/config.go index 317ac44..bae87be 100644 --- a/src/config.go +++ b/src/config.go @@ -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 }