Skip to content

Commit

Permalink
adding more details to hydra configuration docs
Browse files Browse the repository at this point in the history
  • Loading branch information
dbrrt committed Dec 19, 2023
1 parent 0753af9 commit 9004219
Show file tree
Hide file tree
Showing 2 changed files with 97 additions and 8 deletions.
98 changes: 97 additions & 1 deletion apps/docs/pages/appendix/hydra-configuration.mdx
Original file line number Diff line number Diff line change
@@ -1 +1,97 @@
# Hydra Configuration
# Hydra Configuration

Here's a sample Hydra configuration file:

```javascript filename="hydra.config.ts" copy
const HydraConfigAcme = {
schemas: [
{
id: "mgt",
uri: "https://mgt.auth.dog/graphql",
},
{
id: "authz",
uri: "https://authz.auth.dog/graphql",
},
],
rateLimiting: {
default: {
budget: 100,
},
},
publicQueries: [
{
name: "health",
},
{
name: "hydraDevQuery",
},
],
jwksUri: "https://id.authdog.com/oidc/.well-known/jwks.json",
};

export default HydraConfigAcme;
```

Let's walkthrough each field to better understand their role.


## schemas

`schemas` field describe the remote GraphQL endpoints with respective schemas to be consumed by Hydra.

- `id` is a unique identifier for the endpoint
- `uri` is the remote URI of the GraphQL endpoint


```javascript copy
schemas: [
{
id: "mgt",
uri: "https://mgt.auth.dog/graphql",
},
{
id: "authz",
uri: "https://authz.auth.dog/graphql",
},
]
```

## rateLimiting `experimental`

`rateLimiting` defines rate limiting parameters of queries. It requires durable objects enabled on your Cloudflare account.

`default` subfield defines the default rate limiting budget, here `budget` is 100, meaning all queries will be callable 100 times per minutes, from a given IP address.
More facets will be added in the future.

```javascript copy
rateLimiting: {
default: {
budget: 100,
},
},
```

## publicQueries

`publicQueries` field defines the public queries from the schema, that don't require authentication.
If some of your queries are public, but not specified in this list, and consumer is not passing a valid authorization, Hydra will return an unauthorized error (401) by default.

```javascript copy
publicQueries: [
{
name: "health",
},
{
name: "hydraDevQuery",
},
]
```

## jwksUri

`jwksUri` is a remote OpenID endpoint used to validate Hydra endpoint consumer's identity.

```javascript copy
jwksUri: "https://id.authdog.com/oidc/.well-known/jwks.json"
```
7 changes: 0 additions & 7 deletions services/itty-hydra/sync-schema.sh

This file was deleted.

0 comments on commit 9004219

Please sign in to comment.