From 30adbb40e2ae7b61100ce3363633125152e5f66c Mon Sep 17 00:00:00 2001 From: Gerson Alexander Pardo Gamez Date: Sat, 6 Feb 2021 12:29:30 -0500 Subject: [PATCH] added custom server addr on each call --- client/cli.go | 7 +++++++ client/config.go | 4 ++++ 2 files changed, 11 insertions(+) diff --git a/client/cli.go b/client/cli.go index cc8f4a90..56778fa6 100644 --- a/client/cli.go +++ b/client/cli.go @@ -46,6 +46,7 @@ type Options struct { subdomain string command string inspectaddr string + serveraddr string inspectpublic bool tls bool tlsClientCrt string @@ -115,6 +116,11 @@ func ParseArgs() (opts *Options, err error) { "", "Path to a TLS Client Key file if server requires") + serveraddr := flag.String( + "serveraddr", + defaultServerAddr, + "The addr for server") + inspectaddr := flag.String( "inspectaddr", defaultInspectAddr, @@ -136,6 +142,7 @@ func ParseArgs() (opts *Options, err error) { protocol: *protocol, authtoken: *authtoken, hostname: *hostname, + serveraddr: *serveraddr, inspectaddr: *inspectaddr, inspectpublic: *inspectpublic, tls: *tls, diff --git a/client/config.go b/client/config.go index 0ba1fa4a..6b445bea 100644 --- a/client/config.go +++ b/client/config.go @@ -80,6 +80,10 @@ func LoadConfiguration(opts *Options) (config *Configuration, err error) { config.ServerAddr = defaultServerAddr } + if opts.serveraddr != "" { + config.ServerAddr = opts.serveraddr + } + if opts.inspectaddr != "" { config.InspectAddr = opts.inspectaddr }