Files
Tola Leng 933e70a3f6 feat: Implement comprehensive multi-channel notification system with templating and SSL monitoring
- Add robust notification system supporting 7+ communication channels with intelligent message templating, resource monitoring, and SSL certificate alerts. Notification Channels: (Telegram, Discord, Slack, Signal, Email, Google Chat, Webhooks).

- This notification system provides enterprise-grade alerting capabilities with extensive customization options and multi-channel redundancy for critical service monitoring.
2025-08-14 20:50:31 +07:00

71 lines
1.6 KiB
Go

package config
import (
"os"
"strconv"
"time"
)
type Config struct {
Port string
DefaultCount int
DefaultTimeout time.Duration
MaxCount int
MaxTimeout time.Duration
EnableLogging bool
// PocketBase configuration (no auth required)
PocketBaseEnabled bool
PocketBaseURL string
}
func Load() *Config {
cfg := &Config{
Port: getEnv("PORT", "8091"),
DefaultCount: getEnvInt("DEFAULT_COUNT", 4),
DefaultTimeout: getEnvDuration("DEFAULT_TIMEOUT", 15*time.Second),
MaxCount: getEnvInt("MAX_COUNT", 20),
MaxTimeout: getEnvDuration("MAX_TIMEOUT", 30*time.Second),
EnableLogging: getEnvBool("ENABLE_LOGGING", true),
// PocketBase settings (no credentials needed)
PocketBaseEnabled: getEnvBool("POCKETBASE_ENABLED", true),
PocketBaseURL: getEnv("POCKETBASE_URL", ""),
}
return cfg
}
func getEnv(key, defaultValue string) string {
if value := os.Getenv(key); value != "" {
return value
}
return defaultValue
}
func getEnvInt(key string, defaultValue int) int {
if value := os.Getenv(key); value != "" {
if intValue, err := strconv.Atoi(value); err == nil {
return intValue
}
}
return defaultValue
}
func getEnvDuration(key string, defaultValue time.Duration) time.Duration {
if value := os.Getenv(key); value != "" {
if duration, err := time.ParseDuration(value); err == nil {
return duration
}
}
return defaultValue
}
func getEnvBool(key string, defaultValue bool) bool {
if value := os.Getenv(key); value != "" {
if boolValue, err := strconv.ParseBool(value); err == nil {
return boolValue
}
}
return defaultValue
}