Skip to content

Commit

Permalink
Updating config comments
Browse files Browse the repository at this point in the history
  • Loading branch information
mativm02 committed Feb 8, 2024
1 parent a5e8773 commit 08fa280
Show file tree
Hide file tree
Showing 22 changed files with 52 additions and 4 deletions.
11 changes: 9 additions & 2 deletions config.go
Original file line number Diff line number Diff line change
Expand Up @@ -163,8 +163,15 @@ type TykPumpConfiguration struct {
StorageExpirationTime int64 `json:"storage_expiration_time"`
// Setting this to `false` will create a pump that pushes uptime data to Uptime Pump, so the
// Dashboard can read it. Disable by setting to `true`.
DontPurgeUptimeData bool `json:"dont_purge_uptime_data"`
UptimePumpConfig UptimeConf `json:"uptime_pump_config"`
DontPurgeUptimeData bool `json:"dont_purge_uptime_data"`
// Example Uptime Pump configuration:
// ```{.json}
// "uptime_pump_config": {
// "uptime_type": "mongo",
// "mongo_url": "mongodb://localhost:27017",
// "collection_name": "tyk_uptime_analytics"
// },
UptimePumpConfig UptimeConf `json:"uptime_pump_config"`
// The default environment variable prefix for each pump follows this format:
// `TYK_PMP_PUMPS_{PUMP-NAME}_`, for example `TYK_PMP_PUMPS_KAFKA_`.
//
Expand Down
2 changes: 2 additions & 0 deletions pumps/csv.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ type CSVPump struct {

// @PumpConf CSV
type CSVConf struct {
// The prefix for the environment variables that will be used to override the configuration.
// Defaults to `TYK_PMP_PUMPS_CSV_META`
EnvPrefix string `mapstructure:"meta_env_prefix"`
// The directory and the filename where the CSV data will be stored.
CSVDir string `json:"csv_dir" mapstructure:"csv_dir"`
Expand Down
2 changes: 2 additions & 0 deletions pumps/dogstatsd.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ type DogStatsdPump struct {

// @PumpConf DogStatsd
type DogStatsdConf struct {
// The prefix for the environment variables that will be used to override the configuration.
// Defaults to `TYK_PMP_PUMPS_DOGSTATSD_META`
EnvPrefix string `mapstructure:"meta_env_prefix"`
// Prefix for your metrics to datadog.
Namespace string `json:"namespace" mapstructure:"namespace"`
Expand Down
2 changes: 2 additions & 0 deletions pumps/elasticsearch.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ var elasticsearchDefaultENV = PUMPS_ENV_PREFIX + "_ELASTICSEARCH" + PUMPS_ENV_ME

// @PumpConf Elasticsearch
type ElasticsearchConf struct {
// The prefix for the environment variables that will be used to override the configuration.
// Defaults to `TYK_PMP_PUMPS_ELASTICSEARCH_META`
EnvPrefix string `mapstructure:"meta_env_prefix"`
// The name of the index that all the analytics data will be placed in. Defaults to
// "tyk_analytics".
Expand Down
2 changes: 2 additions & 0 deletions pumps/graylog.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ type GraylogPump struct {

// @PumpConf Graylog
type GraylogConf struct {
// The prefix for the environment variables that will be used to override the configuration.
// Defaults to `TYK_PMP_PUMPS_GRAYLOG_META`
EnvPrefix string `mapstructure:"meta_env_prefix"`
// Graylog host.
GraylogHost string `json:"host" mapstructure:"host"`
Expand Down
2 changes: 2 additions & 0 deletions pumps/hybrid.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ type HybridPump struct {

// @PumpConf Hybrid
type HybridPumpConf struct {
// The prefix for the environment variables that will be used to override the configuration.
// Defaults to `TYK_PMP_PUMPS_HYBRID_META`
EnvPrefix string `mapstructure:"meta_env_prefix"`

// MDCB URL connection string
Expand Down
2 changes: 2 additions & 0 deletions pumps/influx.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ var (

// @PumpConf Influx
type InfluxConf struct {
// The prefix for the environment variables that will be used to override the configuration.
// Defaults to `TYK_PMP_PUMPS_INFLUX_META`
EnvPrefix string `mapstructure:"meta_env_prefix"`
// InfluxDB pump database name.
DatabaseName string `json:"database_name" mapstructure:"database_name"`
Expand Down
2 changes: 2 additions & 0 deletions pumps/influx2.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ type RetentionRule struct {

// @PumpConf Influx2
type Influx2Conf struct {
// The prefix for the environment variables that will be used to override the configuration.
// Defaults to `TYK_PMP_PUMPS_INFLUX2_META`
EnvPrefix string `mapstructure:"meta_env_prefix"`
// InfluxDB2 pump bucket name.
BucketName string `mapstructure:"bucket" json:"bucket"`
Expand Down
2 changes: 2 additions & 0 deletions pumps/kafka.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ var kafkaDefaultENV = PUMPS_ENV_PREFIX + "_KAFKA" + PUMPS_ENV_META_PREFIX

// @PumpConf Kafka
type KafkaConf struct {
// The prefix for the environment variables that will be used to override the configuration.
// Defaults to `TYK_PMP_PUMPS_KAFKA_META`
EnvPrefix string `mapstructure:"meta_env_prefix"`
// The list of brokers used to discover the partitions available on the kafka cluster. E.g.
// "localhost:9092".
Expand Down
2 changes: 2 additions & 0 deletions pumps/logzio.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ const (

// @PumpConf Logzio
type LogzioPumpConfig struct {
// The prefix for the environment variables that will be used to override the configuration.
// Defaults to `TYK_PMP_PUMPS_LOGZIO_META`
EnvPrefix string `mapstructure:"meta_env_prefix"`
// Set the sender to check if it crosses the maximum allowed disk usage. Default value is
// `true`.
Expand Down
2 changes: 2 additions & 0 deletions pumps/moesif.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ var moesifDefaultENV = PUMPS_ENV_PREFIX + "_MOESIF" + PUMPS_ENV_META_PREFIX

// @PumpConf Moesif
type MoesifConf struct {
// The prefix for the environment variables that will be used to override the configuration.
// Defaults to `TYK_PMP_PUMPS_MOESIF_META`
EnvPrefix string `mapstructure:"meta_env_prefix"`
// Moesif Application Id. You can find your Moesif Application Id from
// [_Moesif Dashboard_](https://www.moesif.com/) -> _Top Right Menu_ -> _API Keys_ . Moesif
Expand Down
2 changes: 2 additions & 0 deletions pumps/mongo.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ const (
)

type BaseMongoConf struct {
// Prefix for the environment variables that will be used to override the configuration.
// Defaults to `TYK_PMP_PUMPS_MONGO_META`
EnvPrefix string `mapstructure:"meta_env_prefix"`
// The full URL to your MongoDB instance, this can be a clustered instance if necessary and
// should include the database and username / password data.
Expand Down
2 changes: 2 additions & 0 deletions pumps/prometheus.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ type PrometheusPump struct {

// @PumpConf Prometheus
type PrometheusConf struct {
// Prefix for the environment variables that will be used to override the configuration.
// Defaults to `TYK_PMP_PUMPS_PROMETHEUS_META`
EnvPrefix string `mapstructure:"meta_env_prefix"`
// The full URL to your Prometheus instance, {HOST}:{PORT}. For example `localhost:9090`.
Addr string `json:"listen_address" mapstructure:"listen_address"`
Expand Down
1 change: 1 addition & 0 deletions pumps/pump.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ func processPumpEnvVars(pump Pump, log *logrus.Entry, cfg interface{}, defaultEn
log.Error(fmt.Sprintf("Failed to process environment variables for %s pump %s with err:%v ", envVar, pump.GetName(), overrideErr))
}
} else {
fmt.Println("usando defaultEnv:", defaultEnv)
log.Debug(fmt.Sprintf("Checking default %s env variables with prefix %s", pump.GetName(), defaultEnv))
overrideErr := envconfig.Process(defaultEnv, cfg)
if overrideErr != nil {
Expand Down
5 changes: 4 additions & 1 deletion pumps/splunk.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ type SplunkPump struct {
// SplunkPumpConfig contains the driver configuration parameters.
// @PumpConf Splunk
type SplunkPumpConfig struct {
// The prefix for the environment variables that will be used to override the configuration.
// Defaults to `TYK_PMP_PUMPS_SPLUNK_META`
EnvPrefix string `mapstructure:"meta_env_prefix"`
// Address of the datadog agent including host & port.
CollectorToken string `json:"collector_token" mapstructure:"collector_token"`
Expand Down Expand Up @@ -86,7 +88,8 @@ type SplunkPumpConfig struct {
// the amount of bytes, they're send anyways in each `purge_loop`. Default value is 838860800
// (~ 800 MB), the same default value as Splunk config.
BatchMaxContentLength int `json:"batch_max_content_length" mapstructure:"batch_max_content_length"`
// MaxRetries the maximum amount of retries if failed to send requests to splunk HEC. Default value is `0`
// MaxRetries represents the maximum amount of retries to attempt if failed to send requests to splunk HEC.
// Default value is `0`
MaxRetries uint64 `json:"max_retries" mapstructure:"max_retries"`
}

Expand Down
2 changes: 2 additions & 0 deletions pumps/sql.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ type SQLPump struct {

// @PumpConf SQL
type SQLConf struct {
// The prefix for the environment variables that will be used to override the configuration.
// Defaults to `TYK_PMP_PUMPS_SQL_META`
EnvPrefix string `mapstructure:"meta_env_prefix"`
// The supported and tested types are `sqlite` and `postgres`.
Type string `json:"type" mapstructure:"type"`
Expand Down
2 changes: 2 additions & 0 deletions pumps/sql_aggregate.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ type SQLAggregatePumpConf struct {
// TYKCONFIGEXPAND
SQLConf `mapstructure:",squash"`

// The prefix for the environment variables that will be used to override the configuration.
// Defaults to `TYK_PMP_PUMPS_SQLAGGREGATE_META`
EnvPrefix string `mapstructure:"meta_env_prefix"`
// Specifies if it should store aggregated data for all the endpoints. By default, `false`
// which means that only store aggregated data for `tracked endpoints`.
Expand Down
3 changes: 2 additions & 1 deletion pumps/sqs.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ var (

// SQSConf represents the configuration structure for the Tyk Pump SQS (Simple Queue Service) pump.
type SQSConf struct {
// EnvPrefix defines the prefix for environment variables related to this SQS configuration.
// EnvPrefix specifies the prefix for the environment variables that will be used to override the configuration.
// Defaults to `TYK_PMP_PUMPS_SQS_META`
EnvPrefix string `mapstructure:"meta_env_prefix"`

// QueueName specifies the name of the AWS Simple Queue Service (SQS) queue for message delivery.
Expand Down
2 changes: 2 additions & 0 deletions pumps/statsd.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ var statsdDefaultENV = PUMPS_ENV_PREFIX + "_STATSD" + PUMPS_ENV_META_PREFIX

// @PumpConf Statsd
type StatsdConf struct {
// The prefix for the environment variables that will be used to override the configuration.
// Defaults to `TYK_PMP_PUMPS_STATSD_META`
EnvPrefix string `mapstructure:"meta_env_prefix"`
// Address of statsd including host & port.
Address string `json:"address" mapstructure:"address"`
Expand Down
2 changes: 2 additions & 0 deletions pumps/stdout.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ type StdOutPump struct {

// @PumpConf StdOut
type StdOutConf struct {
// The prefix for the environment variables that will be used to override the configuration.
// Defaults to `TYK_PMP_PUMPS_STDOUT_META`
EnvPrefix string `mapstructure:"meta_env_prefix"`
// Format of the analytics logs. Default is `text` if `json` is not explicitly specified. When
// JSON logging is used all pump logs to stdout will be JSON.
Expand Down
2 changes: 2 additions & 0 deletions pumps/syslog.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ var (

// @PumpConf Syslog
type SyslogConf struct {
// The prefix for the environment variables that will be used to override the configuration.
// Defaults to `TYK_PMP_PUMPS_SYSLOG_META`
EnvPrefix string `json:"meta_env_prefix" mapstructure:"meta_env_prefix"`
// Possible values are `udp, tcp, tls` in string form.
Transport string `json:"transport" mapstructure:"transport"`
Expand Down
2 changes: 2 additions & 0 deletions pumps/timestream.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ const (

// @PumpConf Timestream
type TimestreamPumpConf struct {
//The prefix for the environment variables that will be used to override the configuration.
//Defaults to `TYK_PMP_PUMPS_TIMESTREAM_META`
EnvPrefix string `mapstructure:"meta_env_prefix"`
//The aws region that contains the timestream database
AWSRegion string `mapstructure:"aws_region"`
Expand Down

0 comments on commit 08fa280

Please sign in to comment.