github.com/siglens/siglens@v0.0.0-20240328180423-f7ce9ae441ed/pkg/config/common/common.go (about)

     1  package common
     2  
     3  type DeploymentType uint8
     4  
     5  const (
     6  	SingleNode = iota + 1
     7  	SingleNodeS3
     8  	DistributedS3
     9  )
    10  
    11  func (d DeploymentType) String() string {
    12  	return [...]string{"INVALID", "SingleNode", "SingleNodeS3", "DistributedS3"}[d]
    13  }
    14  
    15  type S3Config struct {
    16  	Enabled      bool   `yaml:"enabled"`
    17  	BucketName   string `yaml:"bucketName"`
    18  	BucketPrefix string `yaml:"bucketPrefix"`
    19  	RegionName   string `yaml:"regionName"`
    20  }
    21  
    22  type EmailConfig struct {
    23  	SmtpHost         string `yaml:"smtpHost"`
    24  	SmtpPort         int    `yaml:"smtpPort"`
    25  	SenderEmail      string `yaml:"senderEmail"`
    26  	GmailAppPassword string `yaml:"gmailAppPassword"`
    27  }
    28  
    29  type LogConfig struct {
    30  	LogPrefix             string `yaml:"logPrefix"`             // Prefix of log file. Can be a directory. if empty will log to stdout
    31  	LogFileRotationSizeMB int    `yaml:"logFileRotationSizeMB"` //Max size of log file in megabytes
    32  	CompressLogFile       bool   `yaml:"compressLogFile"`
    33  }
    34  
    35  type TLSConfig struct {
    36  	Enabled         bool   `yaml:"enabled"`         // enable/disable tls
    37  	CertificatePath string `yaml:"certificatePath"` // path to certificate file
    38  	PrivateKeyPath  string `yaml:"privateKeyPath"`  // path to private key file
    39  }
    40  
    41  type AlertConfig struct {
    42  	Enabled  bool   `yaml:"enabled"`
    43  	Provider string `yaml:"provider"`
    44  	Host     string `yaml:"host"`
    45  	Port     uint64 `yaml:"port"`
    46  	User     string `yaml:"user"`
    47  	Password string `yaml:"password"`
    48  	Dbname   string `yaml:"dbname"`
    49  }
    50  
    51  type DatabaseConfig struct {
    52  	Enabled  bool   `yaml:"enabled"`
    53  	Provider string `yaml:"provider"`
    54  	Host     string `yaml:"host"`
    55  	Port     uint64 `yaml:"port"`
    56  	User     string `yaml:"user"`
    57  	Password string `yaml:"password"`
    58  	Dbname   string `yaml:"dbname"`
    59  }
    60  
    61  /*  If you add a new config parameters to the Configuration struct below, make sure to add the default value
    62  assignment in the following functions
    63  1) ExtractConfigData function
    64  2) InitializeDefaultConfig function */
    65  
    66  // If you add a new config parameters to the Configuration struct below, make sure to add a descriptive info in server.yaml
    67  type Configuration struct {
    68  	IngestListenIP             string   `yaml:"ingestListenIP"`       // Listen IP used for ingestion server
    69  	QueryListenIP              string   `yaml:"queryListenIP"`        // Listen IP used for query server
    70  	IngestPort                 uint64   `yaml:"ingestPort"`           // Port for ingestion server
    71  	QueryPort                  uint64   `yaml:"queryPort"`            // Port used for query server
    72  	EventTypeKeywords          []string `yaml:"eventTypeKeywords"`    //Required event type keyword
    73  	QueryNode                  string   `yaml:"queryNode"`            //Node to enable/disable all query endpoints
    74  	IngestNode                 string   `yaml:"ingestNode"`           //Node to enable/disable all ingest endpoints
    75  	SegFlushIntervalSecs       int      `yaml:"segFlushIntervalSecs"` // Time Interval after which to write to segfile
    76  	DataPath                   string   `yaml:"dataPath"`
    77  	RetentionHours             int      `yaml:"retentionHours"`
    78  	TimeStampKey               string   `yaml:"timestampKey"`
    79  	MaxSegFileSize             uint64   `yaml:"maxSegFileSize"` // segment file size (in bytes)
    80  	LicenseKeyPath             string   `yaml:"licenseKeyPath"`
    81  	ESVersion                  string   `yaml:"esVersion"`
    82  	Debug                      bool     `yaml:"debug"`                  // debug logging
    83  	MemoryThresholdPercent     uint64   `yaml:"memoryThresholdPercent"` // percent of all available free data allocated for loading micro indices in memory
    84  	DataDiskThresholdPercent   uint64   `yaml:"dataDiskThresholdPercent"`
    85  	S3IngestQueueName          string   `yaml:"s3IngestQueueName"`
    86  	S3IngestQueueRegion        string   `yaml:"s3IngestQueueRegion"`
    87  	S3IngestBufferSize         uint64   `yaml:"s3IngestBufferSize"`
    88  	MaxParallelS3IngestBuffers uint64   `yaml:"maxParallelS3IngestBuffers"`
    89  	SSInstanceName             string   `yaml:"ssInstanceName"`
    90  	PQSEnabled                 string   `yaml:"pqsEnabled"` // is pqs enabled?
    91  	PQSEnabledConverted        bool     // converted bool value of PQSEnabled yaml
    92  	SafeServerStart            bool     `yaml:"safeMode"`         // if set to true, siglens will start a mock webserver with a custom health handler. Actual server will NOT be started
    93  	AnalyticsEnabled           string   `yaml:"analyticsEnabled"` // is analytics enabled?
    94  	AnalyticsEnabledConverted  bool
    95  	AgileAggsEnabled           string `yaml:"agileAggsEnabled"` // should we read/write AgileAggsTrees?
    96  	AgileAggsEnabledConverted  bool
    97  	QueryHostname              string         `yaml:"queryHostname"` // hostname of the query server. i.e. if DNS is https://cloud.siglens.com, this should be cloud.siglens.com
    98  	IngestUrl                  string         `yaml:"ingestUrl"`     // full address of the ingest server, including scheme and port, e.g. https://ingest.siglens.com:8080
    99  	S3                         S3Config       `yaml:"s3"`            // s3 related config
   100  	Log                        LogConfig      `yaml:"log"`           // Log related config
   101  	TLS                        TLSConfig      `yaml:"tls"`           // TLS related config
   102  	EmailConfig                EmailConfig    `yaml:"emailConfig"`
   103  	DatabaseConfig             DatabaseConfig `yaml:"minionSearch"`
   104  }
   105  
   106  type RunModConfig struct {
   107  	PQSEnabled bool `json:"pqsEnabled"`
   108  }