38
38
fixDBConnDelay time.Duration
39
39
fixDBConnDisableMutex bool
40
40
fixRouteWorkerPoolSize int
41
+
42
+ customerPort int
43
+ driverPort int
44
+ frontendPort int
45
+ routePort int
46
+ Routesdf int
41
47
)
42
48
43
49
// RootCmd represents the base command when called without any subcommands
@@ -57,11 +63,19 @@ func Execute() {
57
63
}
58
64
59
65
func init () {
66
+ Routesdf = 8000
60
67
RootCmd .PersistentFlags ().StringVarP (& metricsBackend , "metrics" , "m" , "expvar" , "Metrics backend (expvar|prometheus)" )
61
68
RootCmd .PersistentFlags ().StringVarP (& jAgentHostPort , "jaeger-agent.host-port" , "a" , "0.0.0.0:6831" , "String representing jaeger-agent UDP host:port, or jaeger-collector HTTP endpoint address, e.g. http://localhost:14268/api/traces." )
62
69
RootCmd .PersistentFlags ().DurationVarP (& fixDBConnDelay , "fix-db-query-delay" , "D" , 300 * time .Millisecond , "Average lagency of MySQL DB query" )
63
70
RootCmd .PersistentFlags ().BoolVarP (& fixDBConnDisableMutex , "fix-disable-db-conn-mutex" , "M" , false , "Disables the mutex guarding db connection" )
64
71
RootCmd .PersistentFlags ().IntVarP (& fixRouteWorkerPoolSize , "fix-route-worker-pool-size" , "W" , 3 , "Default worker pool size" )
72
+
73
+ // Add flags to choose ports for services
74
+ RootCmd .PersistentFlags ().IntVarP (& customerPort , "customer-service-port" , "c" , 8081 , "Port for customer service" )
75
+ RootCmd .PersistentFlags ().IntVarP (& driverPort , "driver-service-port" , "d" , 8082 , "Port for driver service" )
76
+ RootCmd .PersistentFlags ().IntVarP (& frontendPort , "frontend-service-port" , "f" , 8080 , "Port for frontend service" )
77
+ RootCmd .PersistentFlags ().IntVarP (& routePort , "route-service-port" , "r" , 8083 , "Port for routing service" )
78
+
65
79
rand .Seed (int64 (time .Now ().Nanosecond ()))
66
80
logger , _ = zap .NewDevelopment (zap .AddStacktrace (zapcore .FatalLevel ))
67
81
cobra .OnInitialize (onInitialize )
@@ -90,6 +104,22 @@ func onInitialize() {
90
104
logger .Info ("fix: overriding route worker pool size" , zap .Int ("old" , config .RouteWorkerPoolSize ), zap .Int ("new" , fixRouteWorkerPoolSize ))
91
105
config .RouteWorkerPoolSize = fixRouteWorkerPoolSize
92
106
}
107
+
108
+ if customerPort != 8081 {
109
+ logger .Info ("changing customer service port" , zap .Int ("old" , 8081 ), zap .Int ("new" , customerPort ))
110
+ }
111
+
112
+ if driverPort != 8082 {
113
+ logger .Info ("changing driver service port" , zap .Int ("old" , 8082 ), zap .Int ("new" , driverPort ))
114
+ }
115
+
116
+ if frontendPort != 8080 {
117
+ logger .Info ("changing frontend service port" , zap .Int ("old" , 8080 ), zap .Int ("new" , frontendPort ))
118
+ }
119
+
120
+ if routePort != 8083 {
121
+ logger .Info ("changing route service port" , zap .Int ("old" , 8083 ), zap .Int ("new" , routePort ))
122
+ }
93
123
}
94
124
95
125
func logError (logger * zap.Logger , err error ) error {
0 commit comments