Skip to content

Commit

Permalink
Merge pull request #22 from cerberauth/manage-upstream
Browse files Browse the repository at this point in the history
feat: manage upstream
  • Loading branch information
emmanuelgautier authored Apr 15, 2023
2 parents 40c3637 + 7800d8b commit 37025cd
Show file tree
Hide file tree
Showing 4 changed files with 333 additions and 167 deletions.
7 changes: 6 additions & 1 deletion cmd/generate/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ var (
allowedIssuers map[string]string
allowedAudiences map[string]string
serverUrls []string

upstreamUrl string
upstreamStripPath string
)

func NewGenerateCmd() (generateCmd *cobra.Command) {
Expand Down Expand Up @@ -51,7 +54,7 @@ func NewGenerateCmd() (generateCmd *cobra.Command) {
panic(err)
}

g := generator.NewGenerator(prefixId, jwksUris, allowedIssuers, allowedAudiences, serverUrls)
g := generator.NewGenerator(prefixId, jwksUris, allowedIssuers, allowedAudiences, serverUrls, upstreamUrl, upstreamStripPath)
if loadErr := g.LoadOpenAPI3Doc(ctx, doc); loadErr != nil {
panic(loadErr)
}
Expand Down Expand Up @@ -86,6 +89,8 @@ func NewGenerateCmd() (generateCmd *cobra.Command) {
generateCmd.PersistentFlags().StringArrayVarP(&serverUrls, "server-url", "", nil, "API Server Urls")
generateCmd.PersistentFlags().StringVarP(&fileurl, "url", "u", "", "OpenAPI URL")
generateCmd.PersistentFlags().StringVarP(&filepath, "file", "f", "", "OpenAPI File Path")
generateCmd.PersistentFlags().StringVarP(&upstreamUrl, "upstream-url", "", "", "The Upstream URL the request will be forwarded to")
generateCmd.PersistentFlags().StringVarP(&upstreamStripPath, "upstream-strip-path", "", "", "Replaces the provided path prefix when forwarding the requested URL to the upstream URL")
generateCmd.PersistentFlags().StringVarP(&outputpath, "output", "o", "", "Oathkeeper Rules output path")

return generateCmd
Expand Down
Loading

0 comments on commit 37025cd

Please sign in to comment.