package config import ( "fmt" "os" "regexp" "strings" "time" "github.com/spf13/viper" ) var MyConfig *Config type Config struct { Nats NatsConfig Subscription SubscriptionConfig Timeouts TimeoutsConfig Hasura HasuraConfig } type NatsConfig struct { Client string URL string Cluster string } type SubscriptionConfig struct { Topic string `mapstructure:"topic"` QueueGroup string `mapstructure:"queue_group"` } type TimeoutsConfig struct { Server time.Duration `mapstructure:"server"` ReconnectWait time.Duration `mapstructure:"reconnect_wait"` Close time.Duration `mapstructure:"close"` AckWait time.Duration `mapstructure:"ack_wait"` } type BodyConfig struct { Patterns []PatternConfig } type PatternConfig struct { Pattern string Comments string Expression *regexp.Regexp } type HasuraConfig struct { Endpoint string Secret string } const ( EnvProd = "prod" // logConfigFile = "configs/log_config.json" // arrPatternString represents the regular expression pattern used to match arrival patterns. // The pattern matches strings in the format: "(TYPE-NUMBER-SSR-DEPARTURE-ARRIVAL)". // The pattern captures the following named groups: // - category: the three-letter category code // - number: the alphanumeric flight number // - ssr: the alphanumeric SSR code // - departure: the four-letter departure airport code // - arrival: the four-letter arrival airport code arrPatternString = `^\((?P[A-Z]{3})` + `-(?P[A-Z0-9]+)(\/?(?P[A-Z0-9]+))?` + `-(?P[A-Z]{4})` + `-(?P[A-Z]{4})(?P