mirror of https://github.com/dapr/cli.git
Support -dapr-listen-address option to daprd (#1129)
This commit is contained in:
parent
db2ba58147
commit
13eed0eaf3
|
@ -55,6 +55,7 @@ var (
|
|||
appHealthTimeout int
|
||||
appHealthThreshold int
|
||||
enableAPILogging bool
|
||||
apiListenAddresses string
|
||||
)
|
||||
|
||||
const (
|
||||
|
@ -131,6 +132,7 @@ dapr run --app-id myapp --app-port 3000 --app-protocol grpc -- go run main.go
|
|||
AppHealthThreshold: appHealthThreshold,
|
||||
EnableAPILogging: enableAPILogging,
|
||||
InternalGRPCPort: internalGRPCPort,
|
||||
APIListenAddresses: apiListenAddresses,
|
||||
})
|
||||
if err != nil {
|
||||
print.FailureStatusEvent(os.Stderr, err.Error())
|
||||
|
@ -387,6 +389,6 @@ func init() {
|
|||
RunCmd.Flags().IntVar(&appHealthTimeout, "app-health-probe-timeout", 0, "Timeout for app health probes in milliseconds")
|
||||
RunCmd.Flags().IntVar(&appHealthThreshold, "app-health-threshold", 0, "Number of consecutive failures for the app to be considered unhealthy")
|
||||
RunCmd.Flags().BoolVar(&enableAPILogging, "enable-api-logging", false, "Log API calls at INFO verbosity. Valid values are: true or false")
|
||||
|
||||
RunCmd.Flags().StringVar(&apiListenAddresses, "dapr-listen-addresses", "", "Comma separated list of IP addresses that sidecar will listen to")
|
||||
RootCmd.AddCommand(RunCmd)
|
||||
}
|
||||
|
|
|
@ -42,6 +42,7 @@ type RunConfig struct {
|
|||
ConfigFile string `arg:"config"`
|
||||
Protocol string `arg:"app-protocol"`
|
||||
Arguments []string
|
||||
APIListenAddresses string `arg:"dapr-listen-addresses"`
|
||||
EnableProfiling bool `arg:"enable-profiling"`
|
||||
ProfilePort int `arg:"profile-port"`
|
||||
LogLevel string `arg:"log-level"`
|
||||
|
|
|
@ -93,6 +93,7 @@ func assertCommonArgs(t *testing.T, basicConfig *RunConfig, output *RunOutput) {
|
|||
assertArgumentEqual(t, "dapr-http-max-request-size", "-1", output.DaprCMD.Args)
|
||||
assertArgumentEqual(t, "dapr-internal-grpc-port", "5050", output.DaprCMD.Args)
|
||||
assertArgumentEqual(t, "dapr-http-read-buffer-size", "-1", output.DaprCMD.Args)
|
||||
assertArgumentEqual(t, "dapr-listen-addresses", "127.0.0.1", output.DaprCMD.Args)
|
||||
}
|
||||
|
||||
func assertAppEnv(t *testing.T, config *RunConfig, output *RunOutput) {
|
||||
|
@ -154,6 +155,7 @@ func TestRun(t *testing.T) {
|
|||
InternalGRPCPort: 5050,
|
||||
HTTPReadBufferSize: -1,
|
||||
EnableAPILogging: true,
|
||||
APIListenAddresses: "127.0.0.1",
|
||||
}
|
||||
|
||||
t.Run("run happy http", func(t *testing.T) {
|
||||
|
|
Loading…
Reference in New Issue