mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-11 10:06:24 +05:00
Add elsCAPath opt and improve opt comments
This commit is contained in:
committed by
Dan Christian Bogos
parent
e982499e71
commit
2511c00db7
@@ -523,22 +523,22 @@ const CGRATES_CFG_JSON = `
|
||||
|
||||
|
||||
// Elasticsearch options
|
||||
// "elsCloud":true, // ExportPath will be an CLoud ID deployment
|
||||
// "elsApiKey": "", // Base64-encoded token for authorization; if set, overrides username/password and service token.
|
||||
// "elsUsername":"", // Username for HTTP Basic Authentication.
|
||||
// "elsPassword":"", // Password for HTTP Basic Authentication.
|
||||
// "elsServiceToken":"" // Service token for authorization; if set, overrides username/password.
|
||||
// "elsCertificateFingerPrint":"" // SHA256 hex fingerprint given by Elasticsearch on first launch.
|
||||
// "elsDiscoverNodesOnStart":false, // Discover nodes when initializing the client. Default: false.
|
||||
// "elsDiscoverNodesInterval":"10s", // Discover nodes periodically. Default: disabled.
|
||||
// "elsEnableDebugLogger":"false", // Enable the debug logging.
|
||||
// "elsLogger":"", // The logger type can either be elsJson,elsColor and elsText
|
||||
// "elsCompressRequestBody":false, // Enable compression on requests
|
||||
// "elsCompressRequestBodyLevel":0, // Default: gzip.DefaultCompression, 9:BestCompression,-2:HuffmanOnly,1:BestSpeed
|
||||
// "elsRetryOnStatus":[], // List of status codes for retry. Default: 502, 503, 504.
|
||||
// "elsMaxRetries": 0, // Default: 3.
|
||||
// "elsDisableRetry": false, // Default: false.
|
||||
|
||||
// "elsCloud": true, // if true, use cloud ID deployment
|
||||
// "elsApiKey": "", // base64-encoded token for auth; overrides username/password and service token
|
||||
// "elsUsername": "", // username for HTTP Basic Authentication
|
||||
// "elsPassword": "", // password for HTTP Basic Authentication
|
||||
// "elsServiceToken": "", // service token for auth; if set, overrides username/password
|
||||
// "elsCertificateFingerPrint": "", // SHA256 hex fingerprint given by Elasticsearch on first launch
|
||||
// "elsCAPath": "", // path to CA certificate
|
||||
// "elsDiscoverNodesOnStart": false, // discover nodes when initializing the client
|
||||
// "elsDiscoverNodesInterval": "10s", // discover nodes periodically
|
||||
// "elsEnableDebugLogger": "false", // enable the debug logging
|
||||
// "elsLogger": "", // logger type <elsJson|elsColor|elsText>
|
||||
// "elsCompressRequestBody": false, // enable compression on requests
|
||||
// "elsCompressRequestBodyLevel": 0, // compression level <0(gzip)|9(best compression)|-2(HuffmanOnly)|1(best speed)>
|
||||
// "elsRetryOnStatus": [502,503,504], // status codes for retry
|
||||
// "elsMaxRetries": 3, // maximum number of retries
|
||||
// "elsDisableRetry": false, // disable retry mechanism
|
||||
|
||||
// "elsIndex": "", // target elasticsearch index
|
||||
// "elsRefresh": "false", // controls when changes become searchable <true|false|wait_for>
|
||||
|
||||
@@ -173,6 +173,7 @@ type ElsOpts struct {
|
||||
WaitForActiveShards *string
|
||||
|
||||
// elasticsearch client opts
|
||||
CAPath *string
|
||||
DiscoverNodesOnStart *bool
|
||||
DiscoverNodeInterval *time.Duration
|
||||
Cloud *bool
|
||||
@@ -329,6 +330,9 @@ func (elsOpts *ElsOpts) loadFromJSONCfg(jsnCfg *EventExporterOptsJson) (err erro
|
||||
if jsnCfg.ElsPassword != nil {
|
||||
elsOpts.Password = jsnCfg.ElsPassword
|
||||
}
|
||||
if jsnCfg.ElsCAPath != nil {
|
||||
elsOpts.CAPath = jsnCfg.ElsCAPath
|
||||
}
|
||||
if jsnCfg.ElsDiscoverNodesOnStart != nil {
|
||||
elsOpts.DiscoverNodesOnStart = jsnCfg.ElsDiscoverNodesOnStart
|
||||
}
|
||||
|
||||
@@ -1116,6 +1116,7 @@ func TestEEsCfgloadFromJSONCfg(t *testing.T) {
|
||||
ElsCertificateFingerprint: &str,
|
||||
ElsUsername: &str,
|
||||
ElsPassword: &str,
|
||||
ElsCAPath: &str,
|
||||
ElsDiscoverNodesOnStart: &bl,
|
||||
ElsDiscoverNodesInterval: &tms,
|
||||
ElsEnableDebugLogger: &bl,
|
||||
@@ -1175,6 +1176,7 @@ func TestEEsCfgloadFromJSONCfg(t *testing.T) {
|
||||
exp := &ElsOpts{
|
||||
Index: &str,
|
||||
Refresh: &str,
|
||||
CAPath: &str,
|
||||
DiscoverNodesOnStart: &bl,
|
||||
DiscoverNodeInterval: &tm,
|
||||
Cloud: &bl,
|
||||
|
||||
@@ -307,6 +307,7 @@ type EventExporterOptsJson struct {
|
||||
ElsCertificateFingerprint *string `json:"elsCertificateFingerPrint"`
|
||||
ElsUsername *string `json:"elsUsername"`
|
||||
ElsPassword *string `json:"elsPassword"`
|
||||
ElsCAPath *string `json:"elsCAPath"`
|
||||
ElsDiscoverNodesOnStart *bool `json:"elsDiscoverNodesOnStart"`
|
||||
ElsDiscoverNodesInterval *string `json:"elsDiscoverNodesInterval"`
|
||||
ElsEnableDebugLogger *bool `json:"elsEnableDebugLogger"`
|
||||
|
||||
@@ -502,22 +502,22 @@
|
||||
|
||||
|
||||
// // Elasticsearch options
|
||||
// // "elsCloud":true, // ExportPath will be an CLoud ID deployment
|
||||
// // "elsApiKey": "", // Base64-encoded token for authorization; if set, overrides username/password and service token.
|
||||
// // "elsUsername":"", // Username for HTTP Basic Authentication.
|
||||
// // "elsPassword":"", // Password for HTTP Basic Authentication.
|
||||
// // "elsServiceToken":"" // Service token for authorization; if set, overrides username/password.
|
||||
// // "elsCertificateFingerPrint":"" // SHA256 hex fingerprint given by Elasticsearch on first launch.
|
||||
// // "elsDiscoverNodesOnStart":false, // Discover nodes when initializing the client. Default: false.
|
||||
// // "elsDiscoverNodesInterval":"10s", // Discover nodes periodically. Default: disabled.
|
||||
// // "elsEnableDebugLogger":"false", // Enable the debug logging.
|
||||
// // "elsLogger":"", // The logger type can either be elsJson,elsColor and elsText
|
||||
// // "elsCompressRequestBody":false, // Enable compression on requests
|
||||
// // "elsCompressRequestBodyLevel":0, // Default: gzip.DefaultCompression, 9:BestCompression,-2:HuffmanOnly,1:BestSpeed
|
||||
// // "elsRetryOnStatus":[], // List of status codes for retry. Default: 502, 503, 504.
|
||||
// // "elsMaxRetries": 0, // Default: 3.
|
||||
// // "elsDisableRetry": false, // Default: false.
|
||||
|
||||
// // "elsCloud": true, // if true, use cloud ID deployment
|
||||
// // "elsApiKey": "", // base64-encoded token for auth; overrides username/password and service token
|
||||
// // "elsUsername": "", // username for HTTP Basic Authentication
|
||||
// // "elsPassword": "", // password for HTTP Basic Authentication
|
||||
// // "elsServiceToken": "", // service token for auth; if set, overrides username/password
|
||||
// // "elsCertificateFingerPrint": "", // SHA256 hex fingerprint given by Elasticsearch on first launch
|
||||
// // "elsCAPath": "", // path to CA certificate
|
||||
// // "elsDiscoverNodesOnStart": false, // discover nodes when initializing the client
|
||||
// // "elsDiscoverNodesInterval": "10s", // discover nodes periodically
|
||||
// // "elsEnableDebugLogger": "false", // enable the debug logging
|
||||
// // "elsLogger": "", // logger type <elsJson|elsColor|elsText>
|
||||
// // "elsCompressRequestBody": false, // enable compression on requests
|
||||
// // "elsCompressRequestBodyLevel": 0, // compression level <0(gzip)|9(best compression)|-2(HuffmanOnly)|1(best speed)>
|
||||
// // "elsRetryOnStatus": [502,503,504], // status codes for retry
|
||||
// // "elsMaxRetries": 3, // maximum number of retries
|
||||
// // "elsDisableRetry": false, // disable retry mechanism
|
||||
|
||||
// // "elsIndex": "", // target elasticsearch index
|
||||
// // "elsRefresh": "false", // controls when changes become searchable <true|false|wait_for>
|
||||
|
||||
@@ -70,7 +70,7 @@
|
||||
"elsIndex": "cdrs",
|
||||
"elsUsername": "elastic",
|
||||
// "elsPassword":"",
|
||||
"caPath": "/path/to/http_ca.crt"
|
||||
"elsCAPath": "/path/to/http_ca.crt"
|
||||
// "elsCloud":true,
|
||||
// "elsApiKey": "",
|
||||
// "elsServiceToken": "",
|
||||
|
||||
@@ -74,8 +74,8 @@ func (e *ElasticEE) parseClientOpts() error {
|
||||
if opts.APIKey != nil {
|
||||
e.clientCfg.APIKey = *opts.APIKey
|
||||
}
|
||||
if e.Cfg().Opts.RPC.CAPath != nil {
|
||||
cacert, err := os.ReadFile(*e.Cfg().Opts.RPC.CAPath)
|
||||
if opts.CAPath != nil {
|
||||
cacert, err := os.ReadFile(*opts.CAPath)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user