add config option to disable elasticsearch ssl validation
This commit is contained in:
parent
4f2fe0b015
commit
eef9233137
|
@ -39,7 +39,7 @@ Use the Kibana Dev Console to easily run queries: [/app/dev_tools#/console](/app
|
|||
**Create a new index with the custom filename analyzer:**
|
||||
|
||||
```json
|
||||
PUT /crazyfs_search
|
||||
PUT /crazyfs-search
|
||||
{
|
||||
"settings": {
|
||||
"analysis": {
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 57 KiB |
|
@ -42,6 +42,7 @@ type Config struct {
|
|||
ElasticsearchFullSyncOnStart bool
|
||||
ElasticsearchDefaultQueryField string
|
||||
ElasticPrintChanges bool
|
||||
ElasticDisableCertVerificaiton bool
|
||||
HTTPRealIPHeader string
|
||||
HTTPNoMimeSniffHeader bool
|
||||
HTTPAccessControlAllowOriginHeader string
|
||||
|
@ -82,7 +83,7 @@ func SetConfig(configFile string) (*Config, error) {
|
|||
viper.SetDefault("elasticsearch_sync_interval", 1800)
|
||||
viper.SetDefault("elasticsearch_full_sync_interval", 86400)
|
||||
viper.SetDefault("elasticsearch_api_key", "")
|
||||
viper.SetDefault("elasticsearch_index", "crazyfs_search")
|
||||
viper.SetDefault("elasticsearch_index", "crazyfs-search")
|
||||
viper.SetDefault("elasticsearch_sync_workers", 50)
|
||||
viper.SetDefault("elasticsearch_exclude_patterns", []string{".git"})
|
||||
viper.SetDefault("elasticsearch_allow_concurrent_syncs", false)
|
||||
|
@ -90,6 +91,7 @@ func SetConfig(configFile string) (*Config, error) {
|
|||
viper.SetDefault("elasticsearch_query_fields", []string{"extension", "name", "path", "type", "size", "isDir"})
|
||||
viper.SetDefault("elasticsearch_default_query_field", "name")
|
||||
viper.SetDefault("elasticsearch_print_changes", false)
|
||||
viper.SetDefault("elasticsearch_disable_cert_verification", false)
|
||||
viper.SetDefault("http_real_ip_header", "X-Forwarded-For")
|
||||
viper.SetDefault("http_no_mime_sniff_header", false)
|
||||
viper.SetDefault("http_access_control_allow_origin_header", "*")
|
||||
|
@ -143,6 +145,7 @@ func SetConfig(configFile string) (*Config, error) {
|
|||
ElasticsearchExcludePatterns: viper.GetStringSlice("elasticsearch_exclude_patterns"),
|
||||
ElasticsearchFullSyncOnStart: viper.GetBool("elasticsearch_full_sync_on_start"),
|
||||
ElasticsearchDefaultQueryField: viper.GetString("elasticsearch_default_query_field"),
|
||||
ElasticDisableCertVerificaiton: viper.GetBool("elasticsearch_disable_cert_verification"),
|
||||
ElasticPrintChanges: viper.GetBool("elasticsearch_print_changes"),
|
||||
HTTPRealIPHeader: viper.GetString("http_real_ip_header"),
|
||||
HTTPNoMimeSniffHeader: viper.GetBool("http_no_mime_sniff_header"),
|
||||
|
|
|
@ -8,6 +8,7 @@ import (
|
|||
"crazyfs/elastic"
|
||||
"crazyfs/logging"
|
||||
"crazyfs/sharedcache"
|
||||
"crypto/tls"
|
||||
"errors"
|
||||
"flag"
|
||||
"fmt"
|
||||
|
@ -121,10 +122,10 @@ func main() {
|
|||
cfg.ElasticsearchEndpoint,
|
||||
},
|
||||
APIKey: cfg.ElasticsearchAPIKey,
|
||||
//Transport: &http.Transport{
|
||||
// MaxIdleConnsPerHost: config.GetConfig().ElasticsearchSyncWorkers + 1,
|
||||
// IdleConnTimeout: 30 * time.Second,
|
||||
//},
|
||||
Transport: &http.Transport{
|
||||
// Skip certificate verification
|
||||
TLSClientConfig: &tls.Config{InsecureSkipVerify: cfg.ElasticDisableCertVerificaiton},
|
||||
},
|
||||
}
|
||||
es, err := elasticsearch.NewClient(esCfg)
|
||||
if err != nil {
|
||||
|
|
Loading…
Reference in New Issue