diff --git a/README.md b/README.md index ef9fac5..0448117 100644 --- a/README.md +++ b/README.md @@ -63,7 +63,7 @@ Each service lives in `pkg/{service_name}/` with: pkg/petstore/ setup/ openapi.yml # OpenAPI specification - config.yml # Latency, errors, upstream, caching + config.yml # Latency, errors, upstream, replay, caching codegen.yml # Code generation settings context.yml # Custom values for mock data generate.go # go:generate directive @@ -74,7 +74,7 @@ pkg/petstore/ ## API Explorer UI The built-in UI is available at `/` (configurable in `resources/data/app.yml`). -It lets you browse services, view specs, test endpoints, and inspect request/response history. +It lets you browse services, view specs, test endpoints, inspect request/response history, and manage replay recordings. ## Local development diff --git a/cmd/server/main.go b/cmd/server/main.go index 82bb922..c5004ee 100644 --- a/cmd/server/main.go +++ b/cmd/server/main.go @@ -110,6 +110,8 @@ func initRouter() *api.Router { _ = api.CreateHomeRoutes(router) _ = api.CreateServiceRoutes(router) _ = api.CreateHistoryRoutes(router) + _ = api.CreateReplayRoutes(router) + _ = api.CreateServiceConfigRoutes(router) loader.LoadAll(router) services := loader.DefaultRegistry.List() diff --git a/go.mod b/go.mod index 6805c0e..707fdf1 100644 --- a/go.mod +++ b/go.mod @@ -8,7 +8,7 @@ require ( github.com/go-playground/validator/v10 v10.30.1 github.com/joho/godotenv v1.5.1 github.com/lmittmann/tint v1.1.3 - github.com/mockzilla/mockzilla/v2 v2.6.1 + github.com/mockzilla/mockzilla/v2 v2.7.1 ) require ( diff --git a/go.sum b/go.sum index a61ea7f..e406d38 100644 --- a/go.sum +++ b/go.sum @@ -57,8 +57,8 @@ github.com/leodido/go-urn v1.4.0 h1:WT9HwE9SGECu3lg4d/dIA+jxlljEa1/ffXKmRjqdmIQ= github.com/leodido/go-urn v1.4.0/go.mod h1:bvxc+MVxLKB4z00jd1z+Dvzr47oO32F/QSNjSBOlFxI= github.com/lmittmann/tint v1.1.3 h1:Hv4EaHWXQr+GTFnOU4VKf8UvAtZgn0VuKT+G0wFlO3I= github.com/lmittmann/tint v1.1.3/go.mod h1:HIS3gSy7qNwGCj+5oRjAutErFBl4BzdQP6cJZ0NfMwE= -github.com/mockzilla/mockzilla/v2 v2.6.1 h1:DhPX9pd9U6KmWKia+W3c2dK9jPOMgzsH21Y1qgOo/Ro= -github.com/mockzilla/mockzilla/v2 v2.6.1/go.mod h1:zGD4G9Dj1GLw39cDCQZa5CQmUeLNzhBvEYC3ZbGOZ+0= +github.com/mockzilla/mockzilla/v2 v2.7.1 h1:wzK6HlA4pQq5uWP5QlezcKUagXxHrT6Pt7nUNIjYYQA= +github.com/mockzilla/mockzilla/v2 v2.7.1/go.mod h1:zGD4G9Dj1GLw39cDCQZa5CQmUeLNzhBvEYC3ZbGOZ+0= github.com/pb33f/jsonpath v0.8.2 h1:Ou4C7zjYClBm97dfZjDCjdZGusJoynv/vrtiEKNfj2Y= github.com/pb33f/jsonpath v0.8.2/go.mod h1:zBV5LJW4OQOPatmQE2QdKpGQJvhDTlE5IEj6ASaRNTo= github.com/pb33f/libopenapi v0.36.5 h1:Y1FNJ99E+1OW65ijfx447HezNc7vfi9AHYtaPmtj34c= diff --git a/pkg/hello_world/setup/config.yml b/pkg/hello_world/setup/config.yml index a7a6097..24036be 100644 --- a/pkg/hello_world/setup/config.yml +++ b/pkg/hello_world/setup/config.yml @@ -1,4 +1,4 @@ -# yaml-language-server: $schema=https://raw.githubusercontent.com/mockzilla/mockzilla/refs/heads/master/resources/json-schema-service.json +# yaml-language-server: $schema=https://raw.githubusercontent.com/mockzilla/mockzilla/refs/heads/main/resources/json-schema-service.json name: hello-world latency: 0ms cache: diff --git a/pkg/petstore/setup/config.yml b/pkg/petstore/setup/config.yml index a2e0767..845058e 100644 --- a/pkg/petstore/setup/config.yml +++ b/pkg/petstore/setup/config.yml @@ -1,4 +1,4 @@ -# yaml-language-server: $schema=https://raw.githubusercontent.com/mockzilla/mockzilla/refs/heads/master/resources/json-schema-service.json +# yaml-language-server: $schema=https://raw.githubusercontent.com/mockzilla/mockzilla/refs/heads/main/resources/json-schema-service.json name: petstore latency: 0ms cache: diff --git a/resources/data/app.yml b/resources/data/app.yml index 47768bf..650423b 100644 --- a/resources/data/app.yml +++ b/resources/data/app.yml @@ -1,13 +1,19 @@ -# yaml-language-server: $schema=https://raw.githubusercontent.com/mockzilla/mockzilla/refs/heads/master/resources/json-schema.json +# yaml-language-server: $schema=https://raw.githubusercontent.com/mockzilla/mockzilla/refs/heads/main/resources/json-schema.json port: 2200 +homeURL: / editor: theme: chrome darkTheme: cobalt fontSize: 14 -historyDuration: 8h -homeURL: / +history: + enabled: false + duration: 8h + +replay: + enabled: false + duration: 24h ## Storage backend: defaults to memory for local development. ## Override with env vars for deployment: @@ -18,4 +24,4 @@ homeURL: / storage: type: memory redis: - host: localhost + address: localhost:6379