InitFromViper initializes the options struct with values from Viper
(v *viper.Viper)
| 25 | |
| 26 | // InitFromViper initializes the options struct with values from Viper |
| 27 | func (c *Config) InitFromViper(v *viper.Viper) { |
| 28 | address := v.GetString("address") |
| 29 | if address == "" { |
| 30 | address = "0.0.0.0:7777" |
| 31 | } |
| 32 | c.Address = address |
| 33 | c.Backend = v.GetString("backend") |
| 34 | c.TLSEnabled = v.GetBool("tls_enabled") |
| 35 | c.TLSServerEnabeld = v.GetBool("tls_server_enabled") |
| 36 | c.TLS.CertPath = v.GetString("tls_cert_path") |
| 37 | c.TLS.KeyPath = v.GetString("tls_key_path") |
| 38 | c.TLS.CAPath = v.GetString("tls_ca_path") |
| 39 | c.TLS.ServerName = v.GetString("tls_server_name") |
| 40 | c.TLS.InsecureSkipVerify = v.GetBool("tls_insecure_skip_verify") |
| 41 | c.TLS.CipherSuites = v.GetString("tls_cipher_suites") |
| 42 | c.TLS.MinVersion = v.GetString("tls_min_version") |
| 43 | c.QueryServicesDuration = v.GetString("services_query_duration") |
| 44 | c.FindTracesConcurrentRequests = v.GetInt("find_traces_concurrent_requests") |
| 45 | |
| 46 | if c.FindTracesConcurrentRequests == 0 { |
| 47 | c.FindTracesConcurrentRequests = 1 |
| 48 | } |
| 49 | tenantHeader := v.GetString("tenant_header_key") |
| 50 | if tenantHeader == "" { |
| 51 | tenantHeader = bearerTokenKey |
| 52 | } |
| 53 | c.TenantHeaderKey = tenantHeader |
| 54 | } |