Skip to content

Commit

Permalink
doc(schema): Add documentation for schema options
Browse files Browse the repository at this point in the history
  • Loading branch information
ldebruijn committed Dec 22, 2023
1 parent f73dec5 commit 1455da7
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 3 deletions.
13 changes: 11 additions & 2 deletions docs/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,17 @@ target:
keep_alive: 180s

schema:
path: ./schema.graphql

# Path to a local file in which the schema can be found
path: "./schema.graphql"
# Automatically reload the schema file.
# It will reload the contents of the file referenced by the `schema.path` configuration option
# after each `schema.auto_reload.interval` has passed.
auto_reload:
# Enable automatic file reloading
enabled: "true"
# The interval in which the schema file should be reloaded
interval: 5m

persisted_operations:
# Enable or disable the feature, enabled by default
enabled: "true"
Expand Down
34 changes: 34 additions & 0 deletions docs/schema.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Schema

`go-graphql-armor` needs to know your schema in order to perform its validations.

<!-- TOC -->

## Configuration

```yaml
# ...

schema:
# Path to a local file in which the schema can be found
path: "./schema.graphql"
# Automatically reload the schema file.
# It will reload the contents of the file referenced by the `schema.path` configuration option
# after each `schema.auto_reload.interval` has passed.
auto_reload:
# Enable automatic file reloading
enabled: "true"
# The interval in which the schema file should be reloaded
interval: 5m
```
## Metrics
```
go_graphql_armor_schema_reload{state}
```

| `state` | Description |
|-----------|-------------------------------------------------------------|
| `failed` | Reloading the file from local disk has failed |
| `success` | The schema file was successfully reloaded from local disk |
2 changes: 1 addition & 1 deletion internal/business/schema/schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ type Config struct {
AutoReload struct {
Enabled bool `conf:"default:true" yaml:"enabled"`
Interval time.Duration `conf:"default:30s" yaml:"interval"`
}
} `yaml:"auto_reload"`
}

type Provider struct {
Expand Down

0 comments on commit 1455da7

Please sign in to comment.