Documentation ¶
Overview ¶
Package conf contains definition of data type named ConfigStruct that represents configuration of Notification service. This source file also contains function named LoadConfiguration that can be used to load configuration from provided configuration file and/or from environment variables. Additionally several specific functions named GetStorageConfiguration, GetLoggingConfiguration, GetKafkaBrokerConfiguration, GetNotificationsConfiguration and GetMetricsConfiguration are to be used to return specific configuration options.
Index ¶
- Constants
- func GetCloudWatchConfiguration(configuration *ConfigStruct) logger.CloudWatchConfiguration
- func GetKafkaZerologConfiguration(configuration *ConfigStruct) logger.KafkaZerologConfiguration
- func GetLoggingConfiguration(configuration *ConfigStruct) logger.LoggingConfiguration
- func GetSentryLoggingConfiguration(configuration *ConfigStruct) logger.SentryLoggingConfiguration
- type CleanerConfiguration
- type ConfigStruct
- type DependenciesConfiguration
- type KafkaConfiguration
- type LoggingConfiguration
- type MetricsConfiguration
- type NotificationsConfiguration
- type ProcessingConfiguration
- type ServiceLogConfiguration
- type StorageConfiguration
Constants ¶
const ( ConfigFileEnvVariableName = "CCX_NOTIFICATION_SERVICE_CONFIG_FILE" DefaultConfigFileName = "config" )
Constants for env var name and default config filename
Variables ¶
This section is empty.
Functions ¶
func GetCloudWatchConfiguration ¶
func GetCloudWatchConfiguration(configuration *ConfigStruct) logger.CloudWatchConfiguration
GetCloudWatchConfiguration returns cloudwatch configuration
func GetKafkaZerologConfiguration ¶
func GetKafkaZerologConfiguration(configuration *ConfigStruct) logger.KafkaZerologConfiguration
GetKafkaZerologConfiguration returns the kafkazero log configuration
func GetLoggingConfiguration ¶
func GetLoggingConfiguration(configuration *ConfigStruct) logger.LoggingConfiguration
GetLoggingConfiguration returns logging configuration
func GetSentryLoggingConfiguration ¶
func GetSentryLoggingConfiguration(configuration *ConfigStruct) logger.SentryLoggingConfiguration
GetSentryLoggingConfiguration returns sentry logging configuration
Types ¶
type CleanerConfiguration ¶
type CleanerConfiguration struct { // MaxAge is specification of max age for records to be cleaned MaxAge string `mapstructure:"max_age" toml:"max_age"` }
CleanerConfiguration represents configuration for the main cleaner
func GetCleanerConfiguration ¶
func GetCleanerConfiguration(configuration *ConfigStruct) CleanerConfiguration
GetCleanerConfiguration returns cleaner configuration
type ConfigStruct ¶
type ConfigStruct struct { LoggingConf logger.LoggingConfiguration `mapstructure:"logging" toml:"logging"` CloudWatchConf logger.CloudWatchConfiguration `mapstructure:"cloudwatch" toml:"cloudwatch"` SentryLoggingConf logger.SentryLoggingConfiguration `mapstructure:"sentry" toml:"sentry"` KafkaZerologConf logger.KafkaZerologConfiguration `mapstructure:"kafka_zerolog" toml:"kafka_zerolog"` Storage StorageConfiguration `mapstructure:"storage" toml:"storage"` Kafka KafkaConfiguration `mapstructure:"kafka_broker" toml:"kafka_broker"` ServiceLog ServiceLogConfiguration `mapstructure:"service_log" toml:"service_log"` Dependencies DependenciesConfiguration `mapstructure:"dependencies" toml:"dependencies"` Notifications NotificationsConfiguration `mapstructure:"notifications" toml:"notifications"` Metrics MetricsConfiguration `mapstructure:"metrics" toml:"metrics"` Cleaner CleanerConfiguration `mapstructure:"cleaner" toml:"cleaner"` Processing ProcessingConfiguration `mapstructure:"processing" toml:"processing"` DeleteOperation bool }
ConfigStruct is a structure holding the whole notification service configuration
func LoadConfiguration ¶
func LoadConfiguration(configFileEnvVariableName, defaultConfigFile string) (ConfigStruct, error)
LoadConfiguration loads configuration from defaultConfigFile, file set in configFileEnvVariableName or from env
type DependenciesConfiguration ¶
type DependenciesConfiguration struct { ContentServiceServer string `mapstructure:"content_server" toml:"content_server"` ContentServiceEndpoint string `mapstructure:"content_endpoint" toml:"content_endpoint"` TemplateRendererServer string `mapstructure:"template_renderer_server" toml:"template_renderer_server"` TemplateRendererEndpoint string `mapstructure:"template_renderer_endpoint" toml:"template_renderer_endpoint"` TemplateRendererURL string }
DependenciesConfiguration represents configuration of external services and other dependencies
func GetDependenciesConfiguration ¶
func GetDependenciesConfiguration(configuration *ConfigStruct) DependenciesConfiguration
GetDependenciesConfiguration returns dependencies configuration
type KafkaConfiguration ¶
type KafkaConfiguration struct { Enabled bool `mapstructure:"enabled" toml:"enabled"` Addresses string `mapstructure:"addresses" toml:"addresses"` SecurityProtocol string `mapstructure:"security_protocol" toml:"security_protocol"` CertPath string `mapstructure:"cert_path" toml:"cert_path"` SaslMechanism string `mapstructure:"sasl_mechanism" toml:"sasl_mechanism"` SaslUsername string `mapstructure:"sasl_username" toml:"sasl_username"` SaslPassword string `mapstructure:"sasl_password" toml:"sasl_password"` Topic string `mapstructure:"topic" toml:"topic"` Timeout time.Duration `mapstructure:"timeout" toml:"timeout"` LikelihoodThreshold int `mapstructure:"likelihood_threshold" toml:"likelihood_threshold"` ImpactThreshold int `mapstructure:"impact_threshold" toml:"impact_threshold"` SeverityThreshold int `mapstructure:"severity_threshold" toml:"severity_threshold"` TotalRiskThreshold int `mapstructure:"total_risk_threshold" toml:"total_risk_threshold"` Cooldown string `mapstructure:"cooldown" toml:"cooldown"` EventFilter string `mapstructure:"event_filter" toml:"event_filter"` TagFilterEnabled bool `mapstructure:"tag_filter_enabled" toml:"tag_filter_enabled"` Tags []string `mapstructure:"tags" toml:"tags"` TagsSet types.TagsSet }
KafkaConfiguration represents configuration of Kafka brokers and topics
func GetKafkaBrokerConfiguration ¶
func GetKafkaBrokerConfiguration(configuration *ConfigStruct) KafkaConfiguration
GetKafkaBrokerConfiguration returns kafka broker configuration
type LoggingConfiguration ¶
type LoggingConfiguration struct { // Debug enables pretty colored logging Debug bool `mapstructure:"debug" toml:"debug"` // LogLevel sets logging level to show. Possible values are: // "debug" // "info" // "warn", "warning" // "error" // "fatal" // // logging level won't be changed if value is not one of listed above LogLevel string `mapstructure:"log_level" toml:"log_level"` }
LoggingConfiguration represents configuration for logging in general
type MetricsConfiguration ¶
type MetricsConfiguration struct { Job string `mapstructure:"job_name" toml:"job_name"` Namespace string `mapstructure:"namespace" toml:"namespace"` Subsystem string `mapstructure:"subsystem" toml:"subsystem"` GatewayURL string `mapstructure:"gateway_url" toml:"gateway_url"` GatewayAuthToken string `mapstructure:"gateway_auth_token" toml:"gateway_auth_token"` Retries int `mapstructure:"retries" toml:"retries"` RetryAfter time.Duration `mapstructure:"retry_after" toml:"retry_after"` GatewayTimeBetweenPush time.Duration `mapstructure:"gateway_time_between_push" toml:"gateway_time_between_push"` }
MetricsConfiguration holds metrics related configuration
func GetMetricsConfiguration ¶
func GetMetricsConfiguration(configuration *ConfigStruct) MetricsConfiguration
GetMetricsConfiguration returns metrics configuration
type NotificationsConfiguration ¶
type NotificationsConfiguration struct { InsightsAdvisorURL string `mapstructure:"insights_advisor_url" toml:"insights_advisor_url"` ClusterDetailsURI string `mapstructure:"cluster_details_uri" toml:"cluster_details_uri"` RuleDetailsURI string `mapstructure:"rule_details_uri" toml:"rule_details_uri"` }
NotificationsConfiguration represents the configuration specific to the content of notifications
func GetNotificationsConfiguration ¶
func GetNotificationsConfiguration(configuration *ConfigStruct) NotificationsConfiguration
GetNotificationsConfiguration returns configuration related with notification content
type ProcessingConfiguration ¶
type ProcessingConfiguration struct { FilterAllowedClusters bool `mapstructure:"filter_allowed_clusters" toml:"filter_allowed_clusters"` AllowedClusters []string `mapstructure:"allowed_clusters" toml:"allowed_clusters"` FilterBlockedClusters bool `mapstructure:"filter_blocked_clusters" toml:"filter_blocked_clusters"` BlockedClusters []string `mapstructure:"blocked_clusters" toml:"blocked_clusters"` }
ProcessingConfiguration represents configuration for processing subsystem
func GetProcessingConfiguration ¶
func GetProcessingConfiguration(configuration *ConfigStruct) ProcessingConfiguration
GetProcessingConfiguration returns processing configuration
type ServiceLogConfiguration ¶
type ServiceLogConfiguration struct { Enabled bool `mapstructure:"enabled" toml:"enabled"` ClientID string `mapstructure:"client_id" toml:"client_id"` ClientSecret string `mapstructure:"client_secret" toml:"client_secret"` CreatedBy string `mapstructure:"created_by" toml:"created_by"` Username string `mapstructure:"username" toml:"username"` TokenURL string `mapstructure:"token_url" toml:"token_url"` URL string `mapstructure:"url" toml:"url"` Timeout time.Duration `mapstructure:"timeout" toml:"timeout"` LikelihoodThreshold int `mapstructure:"likelihood_threshold" toml:"likelihood_threshold"` ImpactThreshold int `mapstructure:"impact_threshold" toml:"impact_threshold"` SeverityThreshold int `mapstructure:"severity_threshold" toml:"severity_threshold"` TotalRiskThreshold int `mapstructure:"total_risk_threshold" toml:"total_risk_threshold"` Cooldown string `mapstructure:"cooldown" toml:"cooldown"` EventFilter string `mapstructure:"event_filter" toml:"event_filter"` RuleDetailsURI string `mapstructure:"rule_details_uri" toml:"rule_details_uri"` TagFilterEnabled bool `mapstructure:"tag_filter_enabled" toml:"tag_filter_enabled"` Tags []string `mapstructure:"tags" toml:"tags"` TagsSet types.TagsSet }
ServiceLogConfiguration represents configuration of ServiceLog REST API
func GetServiceLogConfiguration ¶
func GetServiceLogConfiguration(configuration *ConfigStruct) ServiceLogConfiguration
GetServiceLogConfiguration returns ServiceLog configuration
type StorageConfiguration ¶
type StorageConfiguration struct { Driver string `mapstructure:"db_driver" toml:"db_driver"` PGUsername string `mapstructure:"pg_username" toml:"pg_username"` PGPassword string `mapstructure:"pg_password" toml:"pg_password"` PGHost string `mapstructure:"pg_host" toml:"pg_host"` PGPort int `mapstructure:"pg_port" toml:"pg_port"` PGDBName string `mapstructure:"pg_db_name" toml:"pg_db_name"` PGParams string `mapstructure:"pg_params" toml:"pg_params"` LogSQLQueries bool `mapstructure:"log_sql_queries" toml:"log_sql_queries"` }
StorageConfiguration represents configuration of postgresQSL data storage
func GetStorageConfiguration ¶
func GetStorageConfiguration(configuration *ConfigStruct) StorageConfiguration
GetStorageConfiguration returns storage configuration