Girish Gowdru | 0c588b2 | 2019-04-23 23:24:56 -0400 | [diff] [blame] | 1 | /* |
cbabu | 116b73f | 2019-12-10 17:56:32 +0530 | [diff] [blame] | 2 | * Copyright 2018-present Open Networking Foundation |
Girish Gowdru | 0c588b2 | 2019-04-23 23:24:56 -0400 | [diff] [blame] | 3 | |
cbabu | 116b73f | 2019-12-10 17:56:32 +0530 | [diff] [blame] | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
Girish Gowdru | 0c588b2 | 2019-04-23 23:24:56 -0400 | [diff] [blame] | 7 | |
cbabu | 116b73f | 2019-12-10 17:56:32 +0530 | [diff] [blame] | 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
Girish Gowdru | 0c588b2 | 2019-04-23 23:24:56 -0400 | [diff] [blame] | 9 | |
cbabu | 116b73f | 2019-12-10 17:56:32 +0530 | [diff] [blame] | 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
Girish Gowdru | 0c588b2 | 2019-04-23 23:24:56 -0400 | [diff] [blame] | 15 | */ |
Girish Gowdru | 6a80bbd | 2019-07-02 07:36:09 -0700 | [diff] [blame] | 16 | |
| 17 | //Package config provides the Log, kvstore, Kafka configuration |
Girish Gowdru | 0c588b2 | 2019-04-23 23:24:56 -0400 | [diff] [blame] | 18 | package config |
| 19 | |
| 20 | import ( |
| 21 | "flag" |
Girish Gowdru | 0c588b2 | 2019-04-23 23:24:56 -0400 | [diff] [blame] | 22 | "os" |
cbabu | 116b73f | 2019-12-10 17:56:32 +0530 | [diff] [blame] | 23 | "time" |
Girish Gowdru | 0c588b2 | 2019-04-23 23:24:56 -0400 | [diff] [blame] | 24 | ) |
| 25 | |
| 26 | // Open OLT default constants |
| 27 | const ( |
cbabu | 116b73f | 2019-12-10 17:56:32 +0530 | [diff] [blame] | 28 | EtcdStoreName = "etcd" |
| 29 | defaultInstanceid = "openOlt001" |
khenaidoo | 106c61a | 2021-08-11 18:05:46 -0400 | [diff] [blame] | 30 | defaultKafkaclusteraddress = "127.0.0.1:9092" |
cbabu | 116b73f | 2019-12-10 17:56:32 +0530 | [diff] [blame] | 31 | defaultKvstoretype = EtcdStoreName |
Neha Sharma | 3f221ae | 2020-04-29 19:02:12 +0000 | [diff] [blame] | 32 | defaultKvstoretimeout = 5 * time.Second |
khenaidoo | 106c61a | 2021-08-11 18:05:46 -0400 | [diff] [blame] | 33 | defaultRPCTimeout = 10 * time.Second |
Neha Sharma | 3f221ae | 2020-04-29 19:02:12 +0000 | [diff] [blame] | 34 | defaultKvstoreaddress = "127.0.0.1:2379" // Port: Consul = 8500; Etcd = 2379 |
David Bainbridge | 2b3d488 | 2020-03-17 15:06:39 -0700 | [diff] [blame] | 35 | defaultLoglevel = "WARN" |
cbabu | 116b73f | 2019-12-10 17:56:32 +0530 | [diff] [blame] | 36 | defaultBanner = false |
| 37 | defaultDisplayVersionOnly = false |
cbabu | 116b73f | 2019-12-10 17:56:32 +0530 | [diff] [blame] | 38 | defaultEventtopic = "voltha.events" |
| 39 | defaultOnunumber = 1 |
Neha Sharma | 3f221ae | 2020-04-29 19:02:12 +0000 | [diff] [blame] | 40 | defaultProbeAddress = ":8080" |
cbabu | 116b73f | 2019-12-10 17:56:32 +0530 | [diff] [blame] | 41 | defaultLiveProbeInterval = 60 * time.Second |
| 42 | defaultNotLiveProbeInterval = 5 * time.Second // Probe more frequently when not alive |
Girish Gowdra | 495dde4 | 2021-03-17 14:59:56 -0700 | [diff] [blame] | 43 | //defaultHeartbeatCheckInterval is the time in seconds the adapter will keep checking the hardware for heartbeat. |
| 44 | defaultHeartbeatCheckInterval = 15 * time.Second |
| 45 | // defaultHeartbeatFailReportInterval is the time adapter will wait before updating the state to the core. |
| 46 | defaultHeartbeatFailReportInterval = 0 * time.Second |
khenaidoo | 106c61a | 2021-08-11 18:05:46 -0400 | [diff] [blame] | 47 | defaultGrpcAddress = ":50060" |
| 48 | defaultCoreEndpoint = ":55555" |
Abhilash Laxmeshwar | f9942e9 | 2020-01-07 15:32:44 +0530 | [diff] [blame] | 49 | //defaultGrpcTimeoutInterval is the time in seconds a grpc call will wait before returning error. |
Girish Kumar | 11e1597 | 2020-06-15 14:51:10 +0000 | [diff] [blame] | 50 | defaultGrpcTimeoutInterval = 2 * time.Second |
| 51 | defaultCurrentReplica = 1 |
| 52 | defaultTotalReplicas = 1 |
| 53 | defaultTraceEnabled = false |
| 54 | defaultTraceAgentAddress = "127.0.0.1:6831" |
| 55 | defaultLogCorrelationEnabled = true |
kesavand | 494c208 | 2020-08-31 11:16:12 +0530 | [diff] [blame] | 56 | defaultOmccEncryption = false |
Gamze Abaka | fcbd6e7 | 2020-12-17 13:25:16 +0000 | [diff] [blame] | 57 | defaultEnableONUStats = false |
| 58 | defaultEnableGEMStats = false |
khenaidoo | 106c61a | 2021-08-11 18:05:46 -0400 | [diff] [blame] | 59 | defaultMinBackoffRetryDelay = 500 * time.Millisecond |
| 60 | defaultMaxBackoffRetryDelay = 10 * time.Second |
| 61 | defaultAdapterEndpoint = "adapter-open-olt" |
Girish Gowdru | 0c588b2 | 2019-04-23 23:24:56 -0400 | [diff] [blame] | 62 | ) |
| 63 | |
| 64 | // AdapterFlags represents the set of configurations used by the read-write adaptercore service |
| 65 | type AdapterFlags struct { |
| 66 | // Command line parameters |
Matteo Scandolo | dfa7a97 | 2020-11-06 13:03:40 -0800 | [diff] [blame] | 67 | AdapterName string |
| 68 | InstanceID string // NOTE what am I used for? why not cli but only ENV? TODO expose in the chart |
Neha Sharma | 3f221ae | 2020-04-29 19:02:12 +0000 | [diff] [blame] | 69 | KafkaClusterAddress string |
Abhilash Laxmeshwar | f9942e9 | 2020-01-07 15:32:44 +0530 | [diff] [blame] | 70 | KVStoreType string |
Neha Sharma | 3f221ae | 2020-04-29 19:02:12 +0000 | [diff] [blame] | 71 | KVStoreTimeout time.Duration |
| 72 | KVStoreAddress string |
khenaidoo | 106c61a | 2021-08-11 18:05:46 -0400 | [diff] [blame] | 73 | RPCTimeout time.Duration |
Abhilash Laxmeshwar | f9942e9 | 2020-01-07 15:32:44 +0530 | [diff] [blame] | 74 | EventTopic string |
Rohan Agrawal | 2488f19 | 2020-01-31 09:26:55 +0000 | [diff] [blame] | 75 | LogLevel string |
Abhilash Laxmeshwar | f9942e9 | 2020-01-07 15:32:44 +0530 | [diff] [blame] | 76 | OnuNumber int |
| 77 | Banner bool |
| 78 | DisplayVersionOnly bool |
Neha Sharma | 3f221ae | 2020-04-29 19:02:12 +0000 | [diff] [blame] | 79 | ProbeAddress string |
Abhilash Laxmeshwar | f9942e9 | 2020-01-07 15:32:44 +0530 | [diff] [blame] | 80 | LiveProbeInterval time.Duration |
| 81 | NotLiveProbeInterval time.Duration |
| 82 | HeartbeatCheckInterval time.Duration |
| 83 | HeartbeatFailReportInterval time.Duration |
| 84 | GrpcTimeoutInterval time.Duration |
khenaidoo | 106c61a | 2021-08-11 18:05:46 -0400 | [diff] [blame] | 85 | GrpcAddress string |
| 86 | CoreEndpoint string |
Matteo Scandolo | 3ad5d2b | 2020-04-02 17:02:04 -0700 | [diff] [blame] | 87 | CurrentReplica int |
| 88 | TotalReplicas int |
Girish Kumar | 11e1597 | 2020-06-15 14:51:10 +0000 | [diff] [blame] | 89 | TraceEnabled bool |
| 90 | TraceAgentAddress string |
| 91 | LogCorrelationEnabled bool |
kesavand | 494c208 | 2020-08-31 11:16:12 +0530 | [diff] [blame] | 92 | OmccEncryption bool |
Gamze Abaka | fcbd6e7 | 2020-12-17 13:25:16 +0000 | [diff] [blame] | 93 | EnableONUStats bool |
| 94 | EnableGEMStats bool |
khenaidoo | 106c61a | 2021-08-11 18:05:46 -0400 | [diff] [blame] | 95 | MinBackoffRetryDelay time.Duration |
| 96 | MaxBackoffRetryDelay time.Duration |
| 97 | AdapterEndpoint string |
Girish Gowdru | 0c588b2 | 2019-04-23 23:24:56 -0400 | [diff] [blame] | 98 | } |
| 99 | |
Girish Gowdru | 6a80bbd | 2019-07-02 07:36:09 -0700 | [diff] [blame] | 100 | // NewAdapterFlags returns a new RWCore config |
Girish Gowdru | 0c588b2 | 2019-04-23 23:24:56 -0400 | [diff] [blame] | 101 | func NewAdapterFlags() *AdapterFlags { |
| 102 | var adapterFlags = AdapterFlags{ // Default values |
Abhilash Laxmeshwar | f9942e9 | 2020-01-07 15:32:44 +0530 | [diff] [blame] | 103 | InstanceID: defaultInstanceid, |
Neha Sharma | 3f221ae | 2020-04-29 19:02:12 +0000 | [diff] [blame] | 104 | KafkaClusterAddress: defaultKafkaclusteraddress, |
Abhilash Laxmeshwar | f9942e9 | 2020-01-07 15:32:44 +0530 | [diff] [blame] | 105 | KVStoreType: defaultKvstoretype, |
| 106 | KVStoreTimeout: defaultKvstoretimeout, |
Neha Sharma | 3f221ae | 2020-04-29 19:02:12 +0000 | [diff] [blame] | 107 | KVStoreAddress: defaultKvstoreaddress, |
Abhilash Laxmeshwar | f9942e9 | 2020-01-07 15:32:44 +0530 | [diff] [blame] | 108 | EventTopic: defaultEventtopic, |
| 109 | LogLevel: defaultLoglevel, |
| 110 | OnuNumber: defaultOnunumber, |
| 111 | Banner: defaultBanner, |
| 112 | DisplayVersionOnly: defaultDisplayVersionOnly, |
Neha Sharma | 3f221ae | 2020-04-29 19:02:12 +0000 | [diff] [blame] | 113 | ProbeAddress: defaultProbeAddress, |
Abhilash Laxmeshwar | f9942e9 | 2020-01-07 15:32:44 +0530 | [diff] [blame] | 114 | LiveProbeInterval: defaultLiveProbeInterval, |
| 115 | NotLiveProbeInterval: defaultNotLiveProbeInterval, |
Girish Gowdra | 495dde4 | 2021-03-17 14:59:56 -0700 | [diff] [blame] | 116 | HeartbeatCheckInterval: defaultHeartbeatCheckInterval, |
| 117 | HeartbeatFailReportInterval: defaultHeartbeatFailReportInterval, |
khenaidoo | 106c61a | 2021-08-11 18:05:46 -0400 | [diff] [blame] | 118 | GrpcAddress: defaultGrpcAddress, |
| 119 | CoreEndpoint: defaultCoreEndpoint, |
Abhilash Laxmeshwar | f9942e9 | 2020-01-07 15:32:44 +0530 | [diff] [blame] | 120 | GrpcTimeoutInterval: defaultGrpcTimeoutInterval, |
Girish Kumar | 11e1597 | 2020-06-15 14:51:10 +0000 | [diff] [blame] | 121 | TraceEnabled: defaultTraceEnabled, |
| 122 | TraceAgentAddress: defaultTraceAgentAddress, |
| 123 | LogCorrelationEnabled: defaultLogCorrelationEnabled, |
kesavand | 494c208 | 2020-08-31 11:16:12 +0530 | [diff] [blame] | 124 | OmccEncryption: defaultOmccEncryption, |
Gamze Abaka | fcbd6e7 | 2020-12-17 13:25:16 +0000 | [diff] [blame] | 125 | EnableONUStats: defaultEnableONUStats, |
| 126 | EnableGEMStats: defaultEnableGEMStats, |
khenaidoo | 106c61a | 2021-08-11 18:05:46 -0400 | [diff] [blame] | 127 | RPCTimeout: defaultRPCTimeout, |
| 128 | MinBackoffRetryDelay: defaultMinBackoffRetryDelay, |
| 129 | MaxBackoffRetryDelay: defaultMaxBackoffRetryDelay, |
Girish Gowdru | 0c588b2 | 2019-04-23 23:24:56 -0400 | [diff] [blame] | 130 | } |
| 131 | return &adapterFlags |
| 132 | } |
| 133 | |
| 134 | // ParseCommandArguments parses the arguments when running read-write adaptercore service |
| 135 | func (so *AdapterFlags) ParseCommandArguments() { |
| 136 | |
khenaidoo | 106c61a | 2021-08-11 18:05:46 -0400 | [diff] [blame] | 137 | flag.StringVar(&(so.KafkaClusterAddress), |
| 138 | "kafka_cluster_address", |
| 139 | defaultKafkaclusteraddress, |
| 140 | "Kafka - Cluster messaging address") |
Girish Gowdru | 0c588b2 | 2019-04-23 23:24:56 -0400 | [diff] [blame] | 141 | |
khenaidoo | 106c61a | 2021-08-11 18:05:46 -0400 | [diff] [blame] | 142 | flag.StringVar(&(so.EventTopic), |
| 143 | "event_topic", |
| 144 | defaultEventtopic, |
| 145 | "Event topic") |
Girish Gowdru | 0c588b2 | 2019-04-23 23:24:56 -0400 | [diff] [blame] | 146 | |
khenaidoo | 106c61a | 2021-08-11 18:05:46 -0400 | [diff] [blame] | 147 | flag.StringVar(&(so.KVStoreType), |
| 148 | "kv_store_type", |
| 149 | defaultKvstoretype, |
| 150 | "KV store type") |
Girish Gowdru | 0c588b2 | 2019-04-23 23:24:56 -0400 | [diff] [blame] | 151 | |
khenaidoo | 106c61a | 2021-08-11 18:05:46 -0400 | [diff] [blame] | 152 | flag.DurationVar(&(so.KVStoreTimeout), |
| 153 | "kv_store_request_timeout", |
| 154 | defaultKvstoretimeout, |
| 155 | "The default timeout when making a kv store request") |
Girish Gowdru | 0c588b2 | 2019-04-23 23:24:56 -0400 | [diff] [blame] | 156 | |
khenaidoo | 106c61a | 2021-08-11 18:05:46 -0400 | [diff] [blame] | 157 | flag.StringVar(&(so.KVStoreAddress), |
| 158 | "kv_store_address", |
| 159 | defaultKvstoreaddress, |
| 160 | "KV store address") |
Devmalya Paul | fb990a5 | 2019-07-09 10:01:49 -0400 | [diff] [blame] | 161 | |
khenaidoo | 106c61a | 2021-08-11 18:05:46 -0400 | [diff] [blame] | 162 | flag.StringVar(&(so.LogLevel), |
| 163 | "log_level", |
| 164 | defaultLoglevel, |
| 165 | "Log level") |
Girish Gowdru | 0c588b2 | 2019-04-23 23:24:56 -0400 | [diff] [blame] | 166 | |
khenaidoo | 106c61a | 2021-08-11 18:05:46 -0400 | [diff] [blame] | 167 | flag.IntVar(&(so.OnuNumber), |
| 168 | "onu_number", |
| 169 | defaultOnunumber, |
| 170 | "Number of ONUs") |
Girish Gowdru | 0c588b2 | 2019-04-23 23:24:56 -0400 | [diff] [blame] | 171 | |
khenaidoo | 106c61a | 2021-08-11 18:05:46 -0400 | [diff] [blame] | 172 | flag.BoolVar(&(so.Banner), |
| 173 | "banner", |
| 174 | defaultBanner, |
| 175 | "Show startup banner log lines") |
Girish Gowdru | 0c588b2 | 2019-04-23 23:24:56 -0400 | [diff] [blame] | 176 | |
khenaidoo | 106c61a | 2021-08-11 18:05:46 -0400 | [diff] [blame] | 177 | flag.BoolVar(&(so.DisplayVersionOnly), |
| 178 | "version", |
| 179 | defaultDisplayVersionOnly, |
| 180 | "Show version information and exit") |
Girish Gowdru | 0c588b2 | 2019-04-23 23:24:56 -0400 | [diff] [blame] | 181 | |
khenaidoo | 106c61a | 2021-08-11 18:05:46 -0400 | [diff] [blame] | 182 | flag.StringVar(&(so.ProbeAddress), |
| 183 | "probe_address", |
| 184 | defaultProbeAddress, |
| 185 | "The address on which to listen to answer liveness and readiness probe queries over HTTP.") |
Girish Gowdru | 0c588b2 | 2019-04-23 23:24:56 -0400 | [diff] [blame] | 186 | |
khenaidoo | 106c61a | 2021-08-11 18:05:46 -0400 | [diff] [blame] | 187 | flag.DurationVar(&(so.LiveProbeInterval), |
| 188 | "live_probe_interval", |
| 189 | defaultLiveProbeInterval, |
| 190 | "Number of seconds for the default liveliness check") |
Matt Jeanneret | f880eb6 | 2019-07-16 20:08:03 -0400 | [diff] [blame] | 191 | |
khenaidoo | 106c61a | 2021-08-11 18:05:46 -0400 | [diff] [blame] | 192 | flag.DurationVar(&(so.NotLiveProbeInterval), |
| 193 | "not_live_probe_interval", |
| 194 | defaultNotLiveProbeInterval, |
| 195 | "Number of seconds for liveliness check if probe is not running") |
Girish Gowdru | 0c588b2 | 2019-04-23 23:24:56 -0400 | [diff] [blame] | 196 | |
khenaidoo | 106c61a | 2021-08-11 18:05:46 -0400 | [diff] [blame] | 197 | flag.DurationVar(&(so.HeartbeatCheckInterval), |
| 198 | "heartbeat_check_interval", |
| 199 | defaultHeartbeatCheckInterval, |
| 200 | "Number of seconds for heartbeat check interval") |
Rohan Agrawal | 828bf4e | 2019-10-22 10:13:19 +0000 | [diff] [blame] | 201 | |
khenaidoo | 106c61a | 2021-08-11 18:05:46 -0400 | [diff] [blame] | 202 | flag.DurationVar(&(so.HeartbeatFailReportInterval), |
| 203 | "heartbeat_fail_interval", |
| 204 | defaultHeartbeatFailReportInterval, |
| 205 | "Number of seconds adapter has to wait before reporting core on the heartbeat check failure") |
cbabu | 116b73f | 2019-12-10 17:56:32 +0530 | [diff] [blame] | 206 | |
khenaidoo | 106c61a | 2021-08-11 18:05:46 -0400 | [diff] [blame] | 207 | flag.DurationVar(&(so.GrpcTimeoutInterval), |
| 208 | "grpc_timeout_interval", |
| 209 | defaultGrpcTimeoutInterval, |
| 210 | "Number of seconds for GRPC timeout") |
cbabu | 116b73f | 2019-12-10 17:56:32 +0530 | [diff] [blame] | 211 | |
khenaidoo | 106c61a | 2021-08-11 18:05:46 -0400 | [diff] [blame] | 212 | flag.IntVar(&(so.CurrentReplica), |
| 213 | "current_replica", |
| 214 | defaultCurrentReplica, |
| 215 | "Replica number of this particular instance") |
Girish Gowdru | 0c588b2 | 2019-04-23 23:24:56 -0400 | [diff] [blame] | 216 | |
khenaidoo | 106c61a | 2021-08-11 18:05:46 -0400 | [diff] [blame] | 217 | flag.IntVar(&(so.TotalReplicas), |
| 218 | "total_replica", |
| 219 | defaultTotalReplicas, |
| 220 | "Total number of instances for this adapter") |
Abhilash Laxmeshwar | f9942e9 | 2020-01-07 15:32:44 +0530 | [diff] [blame] | 221 | |
khenaidoo | 106c61a | 2021-08-11 18:05:46 -0400 | [diff] [blame] | 222 | flag.BoolVar(&(so.TraceEnabled), |
| 223 | "trace_enabled", |
| 224 | defaultTraceEnabled, |
| 225 | "Whether to send logs to tracing agent?") |
Abhilash Laxmeshwar | f9942e9 | 2020-01-07 15:32:44 +0530 | [diff] [blame] | 226 | |
khenaidoo | 106c61a | 2021-08-11 18:05:46 -0400 | [diff] [blame] | 227 | flag.StringVar(&(so.TraceAgentAddress), |
| 228 | "trace_agent_address", |
| 229 | defaultTraceAgentAddress, |
| 230 | "The address of tracing agent to which span info should be sent") |
Matteo Scandolo | 3ad5d2b | 2020-04-02 17:02:04 -0700 | [diff] [blame] | 231 | |
khenaidoo | 106c61a | 2021-08-11 18:05:46 -0400 | [diff] [blame] | 232 | flag.BoolVar(&(so.LogCorrelationEnabled), |
| 233 | "log_correlation_enabled", |
| 234 | defaultLogCorrelationEnabled, |
| 235 | "Whether to enrich log statements with fields denoting operation being executed for achieving correlation?") |
Matteo Scandolo | 3ad5d2b | 2020-04-02 17:02:04 -0700 | [diff] [blame] | 236 | |
khenaidoo | 106c61a | 2021-08-11 18:05:46 -0400 | [diff] [blame] | 237 | flag.BoolVar(&(so.OmccEncryption), |
| 238 | "omcc_encryption", |
| 239 | defaultOmccEncryption, |
| 240 | "OMCI Channel encryption status") |
Girish Kumar | 11e1597 | 2020-06-15 14:51:10 +0000 | [diff] [blame] | 241 | |
khenaidoo | 106c61a | 2021-08-11 18:05:46 -0400 | [diff] [blame] | 242 | flag.BoolVar(&(so.EnableONUStats), |
| 243 | "enable_onu_stats", |
| 244 | defaultEnableONUStats, |
| 245 | "Enable ONU Statistics") |
Girish Kumar | 11e1597 | 2020-06-15 14:51:10 +0000 | [diff] [blame] | 246 | |
khenaidoo | 106c61a | 2021-08-11 18:05:46 -0400 | [diff] [blame] | 247 | flag.BoolVar(&(so.EnableGEMStats), |
| 248 | "enable_gem_stats", |
| 249 | defaultEnableGEMStats, |
| 250 | "Enable GEM Statistics") |
Girish Kumar | 11e1597 | 2020-06-15 14:51:10 +0000 | [diff] [blame] | 251 | |
khenaidoo | 106c61a | 2021-08-11 18:05:46 -0400 | [diff] [blame] | 252 | flag.StringVar(&(so.GrpcAddress), |
| 253 | "grpc_address", |
| 254 | defaultGrpcAddress, |
| 255 | "Adapter GRPC Server address") |
kesavand | 494c208 | 2020-08-31 11:16:12 +0530 | [diff] [blame] | 256 | |
khenaidoo | 106c61a | 2021-08-11 18:05:46 -0400 | [diff] [blame] | 257 | flag.StringVar(&(so.CoreEndpoint), |
| 258 | "core_endpoint", |
| 259 | defaultCoreEndpoint, |
| 260 | "Core endpoint") |
Gamze Abaka | fcbd6e7 | 2020-12-17 13:25:16 +0000 | [diff] [blame] | 261 | |
khenaidoo | 106c61a | 2021-08-11 18:05:46 -0400 | [diff] [blame] | 262 | flag.StringVar(&(so.AdapterEndpoint), |
| 263 | "adapter_endpoint", |
| 264 | defaultAdapterEndpoint, |
| 265 | "Adapter Endpoint") |
| 266 | |
| 267 | flag.DurationVar(&(so.RPCTimeout), |
| 268 | "rpc_timeout", |
| 269 | defaultRPCTimeout, |
| 270 | "The default timeout when making an RPC request") |
| 271 | |
| 272 | flag.DurationVar(&(so.MinBackoffRetryDelay), |
| 273 | "min_retry_delay", |
| 274 | defaultMinBackoffRetryDelay, |
| 275 | "The minimum number of milliseconds to delay before a connection retry attempt") |
| 276 | |
| 277 | flag.DurationVar(&(so.MaxBackoffRetryDelay), |
| 278 | "max_retry_delay", |
| 279 | defaultMaxBackoffRetryDelay, |
| 280 | "The maximum number of milliseconds to delay before a connection retry attempt") |
Gamze Abaka | fcbd6e7 | 2020-12-17 13:25:16 +0000 | [diff] [blame] | 281 | |
Abhilash Laxmeshwar | f9942e9 | 2020-01-07 15:32:44 +0530 | [diff] [blame] | 282 | flag.Parse() |
Girish Gowdru | 0c588b2 | 2019-04-23 23:24:56 -0400 | [diff] [blame] | 283 | containerName := getContainerInfo() |
| 284 | if len(containerName) > 0 { |
| 285 | so.InstanceID = containerName |
| 286 | } |
| 287 | |
| 288 | } |
| 289 | |
| 290 | func getContainerInfo() string { |
| 291 | return os.Getenv("HOSTNAME") |
| 292 | } |