Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[3.x] UI #206

Merged
merged 5 commits into from
Mar 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions .github/workflows/integration-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@ jobs:
name: Run example
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@master
-
name: Checkout
uses: actions/checkout@v4
- name: Run Simple Example
uses: ./
with:
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/unit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ jobs:
matrix:
go-version: [ '1.22' ]
steps:
- uses: actions/checkout@v4
-
name: Checkout
uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
Expand Down
5 changes: 3 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
module github.com/bavix/gripmock

go 1.22.0
go 1.22.1

require (
github.com/bavix/gripmock-sdk-go v1.0.2
github.com/bavix/gripmock-ui v0.0.0-20240323204046-3f969ea2b548
github.com/bavix/gripmock/protogen v0.0.0
github.com/goccy/go-yaml v1.11.3
github.com/google/uuid v1.6.0
Expand Down Expand Up @@ -31,7 +32,7 @@ require (

require (
github.com/apapsch/go-jsonmerge/v2 v2.0.0 // indirect
github.com/bufbuild/protocompile v0.8.0 // indirect
github.com/bufbuild/protocompile v0.9.0 // indirect
github.com/cenkalti/backoff/v4 v4.2.1 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/fatih/color v1.16.0 // indirect
Expand Down
6 changes: 6 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,15 @@ github.com/apapsch/go-jsonmerge/v2 v2.0.0 h1:axGnT1gRIfimI7gJifB699GoE/oq+F2MU7D
github.com/apapsch/go-jsonmerge/v2 v2.0.0/go.mod h1:lvDnEdqiQrp0O42VQGgmlKpxL1AP2+08jFMw88y4klk=
github.com/bavix/gripmock-sdk-go v1.0.2 h1:9FM8G4VVvwNrqGlbAvHjwM8h/TnbrCo4nJhsC8Lvaxw=
github.com/bavix/gripmock-sdk-go v1.0.2/go.mod h1:/Z/81NJ7un4AIeAClLMJhZDyY9CBQOsSbPDqYds2kEY=
github.com/bavix/gripmock-ui v0.0.0-20240323201612-9c398954a28f h1:yvEJ72kfC2+RqPLtkEy4dUd6Aj65m0Fss7CkMsB2MSM=
github.com/bavix/gripmock-ui v0.0.0-20240323201612-9c398954a28f/go.mod h1:XEH4YYEKL+wEDtONntoWm6JxjbVWzl7XtDYztUTBfeA=
github.com/bavix/gripmock-ui v0.0.0-20240323204046-3f969ea2b548 h1:5dcwtgVLjgekwlVsgSF/EPD9wpl8niWyqcCNCrdHhLU=
github.com/bavix/gripmock-ui v0.0.0-20240323204046-3f969ea2b548/go.mod h1:XEH4YYEKL+wEDtONntoWm6JxjbVWzl7XtDYztUTBfeA=
github.com/bmatcuk/doublestar v1.1.1/go.mod h1:UD6OnuiIn0yFxxA2le/rnRU1G4RaI4UvFv1sNto9p6w=
github.com/bufbuild/protocompile v0.8.0 h1:9Kp1q6OkS9L4nM3FYbr8vlJnEwtbpDPQlQOVXfR+78s=
github.com/bufbuild/protocompile v0.8.0/go.mod h1:+Etjg4guZoAqzVk2czwEQP12yaxLJ8DxuqCJ9qHdH94=
github.com/bufbuild/protocompile v0.9.0 h1:DI8qLG5PEO0Mu1Oj51YFPqtx6I3qYXUAhJVJ/IzAVl0=
github.com/bufbuild/protocompile v0.9.0/go.mod h1:s89m1O8CqSYpyE/YaSGtg1r1YFMF5nLTwh4vlj6O444=
github.com/cenkalti/backoff/v4 v4.2.1 h1:y4OZtCnogmCPw98Zjyt5a6+QwPLGkiQsYW5oUqylYbM=
github.com/cenkalti/backoff/v4 v4.2.1/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE=
github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc=
Expand Down
6 changes: 5 additions & 1 deletion stub/stub.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package stub
import (
"context"
"errors"
"github.com/bavix/gripmock/internal/pkg/grpcreflector"
"net"
"net/http"
"time"
Expand All @@ -13,9 +12,11 @@ import (
"github.com/rs/zerolog"
"go.opentelemetry.io/contrib/instrumentation/github.com/gorilla/mux/otelmux"

gripmockui "github.com/bavix/gripmock-ui"
"github.com/bavix/gripmock/internal/app"
"github.com/bavix/gripmock/internal/domain/rest"
"github.com/bavix/gripmock/internal/pkg/features"
"github.com/bavix/gripmock/internal/pkg/grpcreflector"
"github.com/bavix/gripmock/internal/pkg/muxmiddleware"
)

Expand All @@ -32,10 +33,13 @@ func RunRestServer(ctx context.Context, ch chan struct{}, opt Options, reflector

apiServer, _ := app.NewRestServer(opt.StubPath, reflector)

ui, _ := gripmockui.Assets()

router := mux.NewRouter()
router.Use(muxmiddleware.RequestLogger)
router.Use(otelmux.Middleware("gripmock-manager"))
rest.HandlerFromMuxWithBaseURL(apiServer, router, "/api")
router.PathPrefix("/").Handler(http.FileServerFS(ui)).Methods(http.MethodGet)

srv := &http.Server{
Addr: addr,
Expand Down
Loading