package config import ( "fmt" "os" "regexp" "strings" "time" "github.com/spf13/viper" ) var MyConfig *Config type Config struct { Nats NatsConfig Subscription SubscriptionConfig Timeouts TimeoutsConfig } type NatsConfig struct { Client string URL string Cluster string } type SubscriptionConfig struct { Topic string `mapstructure:"topic"` QueueGroup string `mapstructure:"queue_group"` } type TimeoutsConfig struct { ServerTimeout time.Duration `mapstructure:"server_timeout"` ReconnectWait time.Duration `mapstructure:"reconnect_wait"` CloseTimeout time.Duration `mapstructure:"close_timeout"` AckWaitTimeout time.Duration `mapstructure:"ack_wait_timeout"` } type BodyConfig struct { Patterns []PatternConfig } type PatternConfig struct { Pattern string Comments string Expression *regexp.Regexp } const ( // 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-Z]+[0-9]+))?\-(?P[A-Z]{4})\-(?P[A-Z]{4})(?P