Skip to content

Commit

Permalink
feat(reloading): Update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
ldebruijn committed Oct 3, 2023
1 parent e9512b7 commit 406c12a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
5 changes: 3 additions & 2 deletions cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package main

import (
"context"
"errors"
"fmt"
"github.com/ardanlabs/conf/v3"
"github.com/ldebruijn/go-graphql-armor/internal/app/config"
Expand Down Expand Up @@ -58,13 +59,13 @@ func run(log *slog.Logger, cfg *config.Config, shutdown chan os.Signal) error {
}

remoteLoader, err := persisted_operations.RemoteLoaderFromConfig(cfg.PersistedOperations)
if err != nil {
if err != nil && !errors.Is(err, persisted_operations.ErrNoRemoteLoaderSpecified) {
log.Warn("Error initializing remote loader", "err", err)
}

po, err := persisted_operations.NewPersistedOperations(log, cfg.PersistedOperations, persisted_operations.NewLocalDirLoader(cfg.PersistedOperations), remoteLoader)
if err != nil {
log.Error("Error creating Persisted Operations", "err", err)
log.Error("Error initializing Persisted Operations", "err", err)
return nil
}

Expand Down
3 changes: 2 additions & 1 deletion docs/persisted_operations.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ persisted_operations:
store: "./store"
reload:
enabled: true
# The interval in which the local store dir is read and refreshes the internal state
interval: 5m
# The timeout for the remote operation
timeout: 10s
Expand All @@ -37,7 +38,7 @@ persisted_operations:

## How it works

`go-graphql-armor` looks at the store location on local disk to find any `*.json` files it can parse for persisted operations.
`go-graphql-armor` looks at the `store` location on local disk to find any `*.json` files it can parse for persisted operations.

It can be configured to look at this directory and reload based on the files on local disk.

Expand Down

0 comments on commit 406c12a

Please sign in to comment.