Skip to content

Commit

Permalink
added global option (#246)
Browse files Browse the repository at this point in the history
  • Loading branch information
joshtwist authored Oct 5, 2023
1 parent 167b229 commit d4a9ced
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions policies/moesif-inbound/doc.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,21 @@ setMoesifContext(context, {
},
});
```

## Execute on every route

If you want to execute this policy on every route, you can add a hook in your
[runtime extensions](/docs/articles/runtime-extensions) file `zuplo.runtime.ts`:

```ts
import { RuntimeExtensions } from "@zuplo/runtime";

export function runtimeInit(runtime: RuntimeExtensions) {
runtime.addRequestHook((request, context) => {
return context.invokeInboundPolicy("moesif-inbound", request);
});
}
```

Note you can add a guard clause around the context.invokeInboundPolicy if you
want to exclude a few routes.

1 comment on commit d4a9ced

@vercel
Copy link

@vercel vercel bot commented on d4a9ced Oct 5, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

docs – ./

docs-git-main.zuplosite.com
docs.zuplosite.com
docs.zuplopreview.net
docs-site.zuplosite.com

Please sign in to comment.