make runtime port and host configurable

This commit is contained in:
A.Unger
2021-03-18 15:23:36 +01:00
parent 29897cafaf
commit 385d6ecc48
6 changed files with 50 additions and 25 deletions
+9 -7
View File
@@ -20,18 +20,20 @@ func KillCommand(cfg *config.Config) *cli.Command {
Category: "Runtime",
Flags: []cli.Flag{
&cli.StringFlag{
Name: "hostname",
Value: "localhost",
EnvVars: []string{"OCIS_RUNTIME_HOSTNAME"},
Name: "hostname",
Value: "localhost",
EnvVars: []string{"OCIS_RUNTIME_HOSTNAME"},
Destination: &cfg.Runtime.Host,
},
&cli.StringFlag{
Name: "port",
Value: "6060",
EnvVars: []string{"OCIS_RUNTIME_PORT"},
Name: "port",
Value: "6060",
EnvVars: []string{"OCIS_RUNTIME_PORT"},
Destination: &cfg.Runtime.Port,
},
},
Action: func(c *cli.Context) error {
client, err := rpc.DialHTTP("tcp", net.JoinHostPort("localhost", "6060"))
client, err := rpc.DialHTTP("tcp", net.JoinHostPort(cfg.Runtime.Host, cfg.Runtime.Port))
if err != nil {
log.Fatal("dialing:", err)
}
+9 -7
View File
@@ -19,18 +19,20 @@ func ListCommand(cfg *config.Config) *cli.Command {
Category: "Runtime",
Flags: []cli.Flag{
&cli.StringFlag{
Name: "hostname",
Value: "localhost",
EnvVars: []string{"OCIS_RUNTIME_HOSTNAME"},
Name: "hostname",
Value: "localhost",
EnvVars: []string{"OCIS_RUNTIME_HOSTNAME"},
Destination: &cfg.Runtime.Host,
},
&cli.StringFlag{
Name: "port",
Value: "6060",
EnvVars: []string{"OCIS_RUNTIME_PORT"},
Name: "port",
Value: "6060",
EnvVars: []string{"OCIS_RUNTIME_PORT"},
Destination: &cfg.Runtime.Port,
},
},
Action: func(c *cli.Context) error {
client, err := rpc.DialHTTP("tcp", net.JoinHostPort("localhost", "6060"))
client, err := rpc.DialHTTP("tcp", net.JoinHostPort(cfg.Runtime.Host, cfg.Runtime.Port))
if err != nil {
log.Fatal("dialing:", err)
}
+9 -7
View File
@@ -21,18 +21,20 @@ func RunCommand(cfg *config.Config) *cli.Command {
Category: "Runtime",
Flags: []cli.Flag{
&cli.StringFlag{
Name: "hostname",
Value: "localhost",
EnvVars: []string{"OCIS_RUNTIME_HOSTNAME"},
Name: "hostname",
Value: "localhost",
EnvVars: []string{"OCIS_RUNTIME_HOSTNAME"},
Destination: &cfg.Runtime.Host,
},
&cli.StringFlag{
Name: "port",
Value: "6060",
EnvVars: []string{"OCIS_RUNTIME_PORT"},
Name: "port",
Value: "6060",
EnvVars: []string{"OCIS_RUNTIME_PORT"},
Destination: &cfg.Runtime.Port,
},
},
Action: func(c *cli.Context) error {
client, err := rpc.DialHTTP("tcp", net.JoinHostPort("localhost", "6060"))
client, err := rpc.DialHTTP("tcp", net.JoinHostPort(cfg.Runtime.Host, cfg.Runtime.Port))
if err != nil {
log.Fatal("dialing:", err)
}