Skip to content

Commit

Permalink
feat: make public api prefix configurable (#63)
Browse files Browse the repository at this point in the history
* feat: make public api prefix configurable

* fix: default public api prefix
  • Loading branch information
FemiNoviaLina authored Jun 4, 2024
1 parent 5b52f3a commit b05419b
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 2 deletions.
2 changes: 2 additions & 0 deletions internal/server/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,4 +65,6 @@ type Config struct {
DefaultSystemEmail string `yaml:"default_system_email" mapstructure:"default_system_email" default:"[email protected]"`

ServiceData ServiceDataConfig `yaml:"service_data" mapstructure:"service_data"`

PublicAPIPrefix string `yaml:"public_api_prefix" mapstructure:"public_api_prefix" default:"/api"`
}
2 changes: 1 addition & 1 deletion internal/server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ func Serve(
runtime.WithIncomingHeaderMatcher(customHeaderMatcherFunc(map[string]bool{cfg.IdentityProxyHeader: true})),
)

httpMux.Handle("/shield/", http.StripPrefix("/shield", grpcServiceDataGateway))
httpMux.Handle(fmt.Sprintf("%s/", cfg.PublicAPIPrefix), http.StripPrefix(cfg.PublicAPIPrefix, grpcServiceDataGateway))

if err := shieldv1beta1.RegisterServiceDataServiceHandler(ctx, grpcServiceDataGateway, grpcConn); err != nil {
return err
Expand Down
1 change: 1 addition & 0 deletions test/e2e_test/testbench/testbench.go
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,7 @@ func SetupTests(t *testing.T) (shieldv1beta1.ShieldServiceClient, shieldv1beta1.
BootstrapEnabled: true,
MaxNumUpsertData: 1,
},
PublicAPIPrefix: "/api",
},
Proxy: proxy.ServicesConfig{
Services: []proxy.Config{
Expand Down
2 changes: 1 addition & 1 deletion test/e2e_test/testbench/testdata/configs/rules/rule.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
rules:
- backends:
- name: entropy
target: "http://localhost:52118"
target: "http://localhost:51463"
frontends:
- name: ping
path: "/api/ping"
Expand Down

0 comments on commit b05419b

Please sign in to comment.