11package main
22
33import (
4- "fmt"
5- "os"
6-
74 "github.com/VaalaCat/frp-panel/conf"
85 "github.com/sirupsen/logrus"
96 "github.com/spf13/cobra"
@@ -26,11 +23,6 @@ func initCommand() {
2623 apiPort int
2724 apiScheme string
2825 )
29- hostname , err := os .Hostname ()
30- if err != nil {
31- fmt .Println (err )
32- os .Exit (1 )
33- }
3426
3527 clientCmd = & cobra.Command {
3628 Use : "client [-s client secret] [-i client id] [-a app secret] [-r rpc host] [-c rpc port] [-p api port]" ,
@@ -66,8 +58,8 @@ func initCommand() {
6658 rootCmd .AddCommand (clientCmd , serverCmd , masterCmd )
6759 clientCmd .Flags ().StringVarP (& clientSecret , "secret" , "s" , "" , "client secret" )
6860 serverCmd .Flags ().StringVarP (& clientSecret , "secret" , "s" , "" , "client secret" )
69- clientCmd .Flags ().StringVarP (& clientID , "id" , "i" , hostname , "client id" )
70- serverCmd .Flags ().StringVarP (& clientID , "id" , "i" , hostname , "client id" )
61+ clientCmd .Flags ().StringVarP (& clientID , "id" , "i" , "" , "client id" )
62+ serverCmd .Flags ().StringVarP (& clientID , "id" , "i" , "" , "client id" )
7163 clientCmd .Flags ().StringVarP (& rpcHost , "rpc" , "r" , "" , "rpc host" )
7264 serverCmd .Flags ().StringVarP (& rpcHost , "rpc" , "r" , "" , "rpc host" )
7365 clientCmd .Flags ().StringVarP (& appSecret , "app" , "a" , "" , "app secret" )
@@ -109,4 +101,8 @@ func patchConfig(host, secret, clientID, clientSecret, apiScheme string, rpcPort
109101 if len (clientSecret ) != 0 {
110102 conf .Get ().Client .Secret = clientSecret
111103 }
104+ logrus .Infof ("env config rpc host: %s, rpc port: %d, api host: %s, api port: %d, api scheme: %s" ,
105+ conf .Get ().Master .RPCHost , conf .Get ().Master .RPCPort ,
106+ conf .Get ().Master .APIHost , conf .Get ().Master .APIPort ,
107+ conf .Get ().Master .APIScheme )
112108}
0 commit comments