Skip to content

Commit

Permalink
docs: add service config description for configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
berkeli committed Jan 8, 2024
1 parent bee7da8 commit 560d4fa
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 1 deletion.
54 changes: 53 additions & 1 deletion docs/docs/reference/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ service:
cache:
number_of_counters: 10_000
max_cost: 10MiB
relationship:

# The database section specifies the database engine and connection settings,
# including the URI for the database, whether or not to auto-migrate the database,
Expand Down Expand Up @@ -423,6 +422,59 @@ audits, decision logs, authorization model)
</p>
</details>

<details><summary>service | Service Configurations</summary>
<p>

#### Definition

Configurations for the permify service and how it should behave. You can configure the circuit breaker pattern, configuration watcher, and service specific options for permission and schema services (rate limiting, concurrency limiting, cache size).

#### Structure

```
├── service
| ├── circuit_breaker
| ├── watch:
| | ├── enabled
| ├── schema:
| | ├── cache:
| | | ├── number_of_counters
| | | ├── max_cost
| | permission:
| | | ├── bulk_limit
| | | ├── concurrency_limit
| | | ├── cache:
| | | | ├── number_of_counters
| | | | ├── max_cost
```

#### Glossary

| Required | Argument | Default | Description |
|----------|-------------------------------------|---------|---------------------------------------------------|
| [ ] | circuit_breaker | false | switch option to use the circuit breaker pattern. |
| [ ] | watch | false | switch option for configuration watcher. |
| [ ] | schema.cache.number_of_counters | 1_000 | number of counters for schema service. |
| [ ] | schema.cache.max_cost | 10MiB | max cost for schema cache. |
| [ ] | permission.bulk_limit | 100 | bulk operations limit for permission service. |
| [ ] | permission.concurrency_limit | 100 | concurrency limit for permission service. |
| [ ] | permission.cache.max_cost | 10MiB | max cost for permission service. |

#### ENV

| Argument | ENV | Type |
|-----------------------------------------------|--------------------------------------------------------|----------|
| service-circuit-breaker | PERMIFY_SERVICE_CIRCUIT_BREAKER | boolean |
| service-watch-enabled | PERMIFY_SERVICE_WATCH_ENABLED | boolean |
| service-schema-cache-number-of-counters | PERMIFY_SERVICE_SCHEMA_CACHE_NUMBER_OF_COUNTERS | int |
| service-schema-cache-max-cost | PERMIFY_SERVICE_SCHEMA_CACHE_MAX_COST | int |
| service-permission-bulk-limit | PERMIFY_SERVICE_PERMISSION_BULK_LIMIT | int |
| service-permission-concurrency-limit | PERMIFY_SERVICE_PERMISSION_CONCURRENCY_LIMIT | int |
| service-permission-cache-max-cost | PERMIFY_SERVICE_PERMISSION_CACHE_MAX_COST | int |

</p>
</details>

<details><summary>profiler | Performance Profiler Configurations</summary>
<p>

Expand Down
8 changes: 8 additions & 0 deletions pkg/cmd/flags/serve.go
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,14 @@ func RegisterServeFlags(cmd *cobra.Command) {
panic(err)
}

flags.Int("service-permission-bulk-limit", conf.Service.Permission.BulkLimit, "bulk operations limit")
if err = viper.BindPFlag("service.permission.bulk_limit", flags.Lookup("service-permission-bulk-limit")); err != nil {
panic(err)
}
if err = viper.BindEnv("service.permission.bulk_limit", "PERMIFY_SERVICE_PERMISSION_BULK_LIMIT"); err != nil {
panic(err)
}

flags.Int("service-permission-concurrency-limit", conf.Service.Permission.ConcurrencyLimit, "concurrency limit")
if err = viper.BindPFlag("service.permission.concurrency_limit", flags.Lookup("service-permission-concurrency-limit")); err != nil {
panic(err)
Expand Down

0 comments on commit 560d4fa

Please sign in to comment.