diff --git a/diagnostic/client.go b/diagnostic/client.go index 3b62ad14..13063efb 100644 --- a/diagnostic/client.go +++ b/diagnostic/client.go @@ -64,7 +64,7 @@ type LogConfiguration struct { } func (client *httpClient) GetLogConfiguration(ctx context.Context) (*LogConfiguration, error) { - response, err := client.GET(ctx, configurationEndpoint) + response, err := client.GET(ctx, cliConfigurationEndpoint) if err != nil { return nil, err } @@ -153,6 +153,24 @@ func (client *httpClient) GetMetrics(ctx context.Context, writer io.Writer) erro return copyToWriter(response, writer) } +func (client *httpClient) GetTunnelConfiguration(ctx context.Context, writer io.Writer) error { + response, err := client.GET(ctx, tunnelConfigurationEndpoint) + if err != nil { + return err + } + + return copyToWriter(response, writer) +} + +func (client *httpClient) GetCliConfiguration(ctx context.Context, writer io.Writer) error { + response, err := client.GET(ctx, cliConfigurationEndpoint) + if err != nil { + return err + } + + return copyToWriter(response, writer) +} + func copyToWriter(response *http.Response, writer io.Writer) error { defer response.Body.Close() @@ -171,4 +189,6 @@ type HTTPClient interface { GetTunnelState(ctx context.Context) (*TunnelState, error) GetSystemInformation(ctx context.Context, writer io.Writer) error GetMetrics(ctx context.Context, writer io.Writer) error + GetCliConfiguration(ctx context.Context, writer io.Writer) error + GetTunnelConfiguration(ctx context.Context, writer io.Writer) error } diff --git a/diagnostic/consts.go b/diagnostic/consts.go index e98f5e71..01059279 100644 --- a/diagnostic/consts.go +++ b/diagnostic/consts.go @@ -15,10 +15,11 @@ const ( tailMaxNumberOfLines = "10000" // maximum number of log lines from a virtual runtime (docker or kubernetes) // Endpoints used by the diagnostic HTTP Client. - configurationEndpoint = "diag/configuration" - tunnelStateEndpoint = "diag/tunnel" - systemInformationEndpoint = "diag/system" - memoryDumpEndpoint = "debug/pprof/heap" - goroutineDumpEndpoint = "debug/pprof/goroutine" - metricsEndpoint = "metrics" + cliConfigurationEndpoint = "/diag/configuration" + tunnelStateEndpoint = "/diag/tunnel" + systemInformationEndpoint = "/diag/system" + memoryDumpEndpoint = "debug/pprof/heap" + goroutineDumpEndpoint = "debug/pprof/goroutine" + metricsEndpoint = "metrics" + tunnelConfigurationEndpoint = "/config" ) diff --git a/diagnostic/handlers.go b/diagnostic/handlers.go index e8fb7e62..ef140bd8 100644 --- a/diagnostic/handlers.go +++ b/diagnostic/handlers.go @@ -56,7 +56,7 @@ func NewDiagnosticHandler( } func (handler *Handler) InstallEndpoints(router *http.ServeMux) { - router.HandleFunc(configurationEndpoint, handler.ConfigurationHandler) + router.HandleFunc(cliConfigurationEndpoint, handler.ConfigurationHandler) router.HandleFunc(tunnelStateEndpoint, handler.TunnelStateHandler) router.HandleFunc(systemInformationEndpoint, handler.SystemHandler) }