Skip to content

Commit

Permalink
Allow importing apisprout from external packages
Browse files Browse the repository at this point in the history
This can be useful for testing go code against the mock server.
The mock server could be started in a go test and the tests are not
dependant on a docker daemon or similar runtime.

To start a server or get a http.Handler without passing a file path or
URL, the server is separated into a server (`OpenAPIServer`) that only
requires an `openapi3.T` to run and the loading from a file or URL is
handled by a `ConfigReloader`. It can load from a URL or file path and
reload the `OpenAPIServer` on file changes.

Signed-off-by: leonnicolas <[email protected]>
  • Loading branch information
leonnicolas committed Nov 28, 2022
1 parent 55a1793 commit fb67524
Show file tree
Hide file tree
Showing 9 changed files with 1,316 additions and 301 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ WORKDIR /apisprout
COPY . .
RUN apk add --no-cache git && \
go get github.com/ahmetb/govvv && \
govvv install
govvv install ./cmd/apisprout

FROM alpine:3.8
COPY --from=build /go/bin/apisprout /usr/local/bin/
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ Download the appropriate binary from the [releases](https://github.com/danielgta
Alternatively, you can use `go get`:

```sh
go get github.com/danielgtaylor/apisprout
go get github.com/danielgtaylor/apisprout/cmd/apisprout
```

## Extra Features
Expand Down
Loading

0 comments on commit fb67524

Please sign in to comment.