rework config

This commit is contained in:
A.Unger
2021-03-09 15:55:45 +01:00
parent 757cb9abe9
commit 29910838c1
66 changed files with 2502 additions and 195 deletions
+19 -26
View File
@@ -1,13 +1,8 @@
package command
import (
"fmt"
"log"
"net"
"net/rpc"
"github.com/micro/cli/v2"
"github.com/owncloud/ocis/ocis/pkg/config"
"github.com/owncloud/ocis/ocis-pkg/config"
"github.com/owncloud/ocis/ocis/pkg/register"
)
@@ -19,31 +14,29 @@ func ListCommand(cfg *config.Config) *cli.Command {
Category: "Runtime",
Flags: []cli.Flag{
&cli.StringFlag{
Name: "hostname",
Value: "localhost",
EnvVars: []string{"OCIS_RUNTIME_HOSTNAME"},
Destination: &cfg.Runtime.Hostname,
Name: "hostname",
Value: "localhost",
EnvVars: []string{"OCIS_RUNTIME_HOSTNAME"},
},
&cli.StringFlag{
Name: "port",
Value: "10666",
EnvVars: []string{"OCIS_RUNTIME_PORT"},
Destination: &cfg.Runtime.Port,
Name: "port",
Value: "10666",
EnvVars: []string{"OCIS_RUNTIME_PORT"},
},
},
Action: func(c *cli.Context) error {
client, err := rpc.DialHTTP("tcp", net.JoinHostPort(cfg.Runtime.Hostname, cfg.Runtime.Port))
if err != nil {
log.Fatal("dialing:", err)
}
var arg1 string
if err := client.Call("Service.List", struct{}{}, &arg1); err != nil {
log.Fatal(err)
}
fmt.Println(arg1)
//client, err := rpc.DialHTTP("tcp", net.JoinHostPort(cfg.Runtime.Hostname, cfg.Runtime.Port))
//if err != nil {
// log.Fatal("dialing:", err)
//}
//
//var arg1 string
//
//if err := client.Call("Service.List", struct{}{}, &arg1); err != nil {
// log.Fatal(err)
//}
//
//fmt.Println(arg1)
return nil
},