Skip to content

Commit b2d657d

Browse files
committed
Formatting [ci skip]
1 parent 232396c commit b2d657d

File tree

5 files changed

+46
-47
lines changed

5 files changed

+46
-47
lines changed

proxy/types.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,6 @@ type Service struct {
100100
LookupRetry int
101101
LookupRetryInterval int
102102
ServiceDest []ServiceDest
103-
104103
}
105104

106105
type Services []Service

server/server.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@ import (
55
"../proxy"
66
"encoding/json"
77
"fmt"
8+
"github.com/kelseyhightower/envconfig"
89
"net/http"
910
"os"
1011
"strconv"
1112
"strings"
12-
"github.com/kelseyhightower/envconfig"
1313
)
1414

1515
var usersBasePath string = "/run/secrets/dfp_users_%s"
@@ -257,8 +257,8 @@ func (m *Serve) getServiceFromEnvVars(prefix string) (proxy.Service, error) {
257257
}
258258
sd := []proxy.ServiceDest{}
259259
path := []string{}
260-
if len(os.Getenv(prefix + "_SERVICE_PATH")) > 0 {
261-
path = strings.Split(os.Getenv(prefix + "_SERVICE_PATH"), ",")
260+
if len(os.Getenv(prefix+"_SERVICE_PATH")) > 0 {
261+
path = strings.Split(os.Getenv(prefix+"_SERVICE_PATH"), ",")
262262
}
263263
port := os.Getenv(prefix + "_PORT")
264264
srcPort, _ := strconv.Atoi(os.Getenv(prefix + "_SRC_PORT"))

server/server_test.go

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ import (
99
"github.com/stretchr/testify/suite"
1010
"net/http"
1111
"net/http/httptest"
12-
"strings"
13-
"testing"
1412
"os"
1513
"strconv"
14+
"strings"
15+
"testing"
1616
)
1717

1818
type ServerTestSuite struct {
@@ -793,29 +793,29 @@ func (s *ServerTestSuite) Test_UsersMerge_AllCases() {
793793

794794
func (s *ServerTestSuite) Test_GetServicesFromEnvVars_ReturnsServices() {
795795
service := proxy.Service{
796-
AclName: "my-AclName",
797-
ConsulTemplateBePath: "my-ConsulTemplateBePath",
798-
ConsulTemplateFePath: "my-ConsulTemplateFePath",
799-
Distribute: true,
800-
HttpsOnly: true,
801-
HttpsPort: 1234,
802-
OutboundHostname: "my-OutboundHostname",
803-
PathType: "my-PathType",
796+
AclName: "my-AclName",
797+
ConsulTemplateBePath: "my-ConsulTemplateBePath",
798+
ConsulTemplateFePath: "my-ConsulTemplateFePath",
799+
Distribute: true,
800+
HttpsOnly: true,
801+
HttpsPort: 1234,
802+
OutboundHostname: "my-OutboundHostname",
803+
PathType: "my-PathType",
804804
RedirectWhenHttpProto: true,
805-
ReqMode: "my-ReqMode",
806-
ReqPathReplace: "my-ReqPathReplace",
807-
ReqPathSearch: "my-ReqPathSearch",
808-
ServiceCert: "my-ServiceCert",
809-
ServiceDomain: []string{"my-domain-1.com", "my-domain-2.com"},
805+
ReqMode: "my-ReqMode",
806+
ReqPathReplace: "my-ReqPathReplace",
807+
ReqPathSearch: "my-ReqPathSearch",
808+
ServiceCert: "my-ServiceCert",
809+
ServiceDomain: []string{"my-domain-1.com", "my-domain-2.com"},
810810
ServiceDomainMatchAll: true,
811-
ServiceName: "my-ServiceName",
812-
SkipCheck: true,
813-
SslVerifyNone: true,
814-
TemplateBePath: "my-TemplateBePath",
815-
TemplateFePath: "my-TemplateFePath",
816-
TimeoutServer: "my-TimeoutServer",
817-
TimeoutTunnel: "my-TimeoutTunnel",
818-
XForwardedProto: true,
811+
ServiceName: "my-ServiceName",
812+
SkipCheck: true,
813+
SslVerifyNone: true,
814+
TemplateBePath: "my-TemplateBePath",
815+
TemplateFePath: "my-TemplateFePath",
816+
TimeoutServer: "my-TimeoutServer",
817+
TimeoutTunnel: "my-TimeoutTunnel",
818+
XForwardedProto: true,
819819
ServiceDest: []proxy.ServiceDest{
820820
{Port: "1111", ServicePath: []string{"my-path-11", "my-path-12"}, SrcPort: 1112},
821821
},
@@ -1011,11 +1011,11 @@ func getRemoveMock(skipMethod string) *RemoveMock {
10111011
}
10121012

10131013
type ReconfigureMock struct {
1014-
ExecuteMock func(args []string) error
1015-
GetDataMock func() (actions.BaseReconfigure, proxy.Service)
1016-
ReloadServicesFromListenerMock func(addresses []string, instanceName, mode, listenerAddress string) error
1017-
GetTemplatesMock func(sr *proxy.Service) (front, back string, err error)
1018-
GetServicesFromEnvVarsMock func() []proxy.Service
1014+
ExecuteMock func(args []string) error
1015+
GetDataMock func() (actions.BaseReconfigure, proxy.Service)
1016+
ReloadServicesFromListenerMock func(addresses []string, instanceName, mode, listenerAddress string) error
1017+
GetTemplatesMock func(sr *proxy.Service) (front, back string, err error)
1018+
GetServicesFromEnvVarsMock func() []proxy.Service
10191019
}
10201020

10211021
func (m ReconfigureMock) Execute(args []string) error {

server/util_test.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
package server
22

33
import (
4+
"fmt"
45
"github.com/stretchr/testify/suite"
5-
"testing"
6+
"io/ioutil"
67
"net/http"
7-
"fmt"
8-
"net/url"
98
"net/http/httptest"
9+
"net/url"
1010
"strings"
11-
"io/ioutil"
11+
"testing"
1212
)
1313

1414
type UtilTestSuite struct {
@@ -152,4 +152,4 @@ func (s *ServerTestSuite) Test_SendDistributeRequests_ReturnsError_WhenProxyIPsA
152152

153153
s.Assertions.Equal(http.StatusBadRequest, actualStatus)
154154
s.Assertions.Error(err)
155-
}
155+
}

server_test.go

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -486,11 +486,11 @@ func (m CertMock) Init() error {
486486
}
487487

488488
type ServerMock struct {
489-
GetServiceFromUrlMock func(req *http.Request) *proxy.Service
490-
TestHandlerMock func(w http.ResponseWriter, req *http.Request)
491-
ReconfigureHandlerMock func(w http.ResponseWriter, req *http.Request)
492-
ReloadHandlerMock func(w http.ResponseWriter, req *http.Request)
493-
RemoveHandlerMock func(w http.ResponseWriter, req *http.Request)
489+
GetServiceFromUrlMock func(req *http.Request) *proxy.Service
490+
TestHandlerMock func(w http.ResponseWriter, req *http.Request)
491+
ReconfigureHandlerMock func(w http.ResponseWriter, req *http.Request)
492+
ReloadHandlerMock func(w http.ResponseWriter, req *http.Request)
493+
RemoveHandlerMock func(w http.ResponseWriter, req *http.Request)
494494
GetServicesFromEnvVarsMock func() *[]proxy.Service
495495
}
496496

@@ -536,11 +536,11 @@ func getRunMock(skipMethod string) *RunMock {
536536
}
537537

538538
type ReconfigureMock struct {
539-
ExecuteMock func(args []string) error
540-
GetDataMock func() (actions.BaseReconfigure, proxy.Service)
541-
ReloadServicesFromListenerMock func(addresses []string, instanceName, mode, listenerAddress string) error
542-
GetTemplatesMock func(sr *proxy.Service) (front, back string, err error)
543-
GetServicesFromEnvVarsMock func() []proxy.Service
539+
ExecuteMock func(args []string) error
540+
GetDataMock func() (actions.BaseReconfigure, proxy.Service)
541+
ReloadServicesFromListenerMock func(addresses []string, instanceName, mode, listenerAddress string) error
542+
GetTemplatesMock func(sr *proxy.Service) (front, back string, err error)
543+
GetServicesFromEnvVarsMock func() []proxy.Service
544544
}
545545

546546
func (m ReconfigureMock) Execute(args []string) error {

0 commit comments

Comments
 (0)