Skip to content

Commit 6f6d347

Browse files
authored
feat: autogenerated configuration page (#938)
1 parent d53650b commit 6f6d347

File tree

6 files changed

+553
-46
lines changed

6 files changed

+553
-46
lines changed

docs/content/getting-started/setup-openfga/configuration.mdx

Lines changed: 216 additions & 0 deletions
Large diffs are not rendered by default.

docs/content/getting-started/setup-openfga/configure-openfga.mdx

Lines changed: 11 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -17,51 +17,11 @@ Refer to the [OpenFGA Getting Started](https://github.com/openfga/openfga?tab=re
1717

1818
The instructions below assume OpenFGA is installed and that you have the `openfga` binary in your PATH. If you have built `openfga` as a binary, but not in your path, you can refer to it directly (e.g. replace `openfga` in the instructions below with `./openfga` or `/path/to/openfga`).
1919

20-
You can configure the OpenFGA server in three ways:
20+
For a list of all the configuration options that the latest release of OpenFGA supports, see [Configuration Options](./configuration.mdx), or you can run `openfga --help` to see the ones specific to your version.
2121

22-
- Using a configuration file.
23-
- Using environment variables.
24-
- Using command line parameters.
25-
26-
If the same option is configured in multiple ways the command line parameters will take precedence over environment variables, which will take precedence over the configuration file.
27-
28-
The configuration options and their default values are shown via `openfga run --help`, and defined in [config-schema.json](https://github.com/openfga/openfga/blob/main/.config-schema.json).
29-
30-
## Using a configuration file
31-
32-
You can configure the OpenFGA server with a `config.yaml` file, which can be specified in either:
33-
- `/etc/openfga`
34-
- `$HOME/.openfga`
35-
- `.` (i.e., the current working directory).
36-
37-
The OpenFGA server will search for the configuration file in the above order.
38-
39-
Here is a sample configuration to run OpenFGA with a Postgres database and using a preshared key for authentication:
40-
41-
```yaml
42-
datastore:
43-
engine: postgres
44-
uri: postgres://user:password@localhost:5432/mydatabase
45-
authn:
46-
method: preshared
47-
preshared:
48-
keys: ["key1", "key2"]
49-
```
50-
51-
## Using environment variables
52-
53-
The OpenFGA server supports **environment variables** for configuration, and they will take priority over your configuration file.
54-
Each variable must be prefixed with `OPENFGA_` and followed by your option in uppercase (e.g. `--grpc-tls-key` becomes `OPENFGA_GRPC_TLS_KEY`).
55-
56-
## Using command line variables
57-
58-
Command line parameters take precedence over environment variables and options in the configuration file. They are prefixed with `--` , e.g.
59-
60-
```shell
61-
openfga run \
62-
--datastore-engine postgres \
63-
--datastore-uri 'postgres://postgres:password@postgres:5432/postgres?sslmode=disable'
64-
```
22+
:::note
23+
The instructions below are for configuring the standalone OpenFGA server. If you are using OpenFGA as a library, you can refer to the [GoDoc](https://pkg.go.dev/github.com/openfga/openfga) for more information.
24+
:::
6525

6626
## Configuring data storage
6727

@@ -274,7 +234,7 @@ grpcurl -plaintext $FGA_API_URL grpc.health.v1.Health/Check
274234
</Tabs>
275235

276236
## Experimental features
277-
Various releases of OpenFGA may have experimental features that can be enabled by providing the `--experimentals` flag or the `experimentals` config.
237+
Various releases of OpenFGA may have experimental features that can be enabled by providing the [`--experimentals`](./configuration.mdx#OPENFGA_EXPERIMENTALS) flag or the `experimentals` config.
278238

279239
```
280240
openfga run --experimentals="feature1, feature2"
@@ -356,6 +316,12 @@ It is highly recommended to enable logging in production environments. Disabling
356316
<RelatedSection
357317
description="Check the following sections for more on how to use OpenFGA."
358318
relatedLinks={[
319+
{
320+
title: 'Configuration Options',
321+
description: 'Find out all the different flags and options that OpenFGA accepts',
322+
link: './configuration',
323+
id: './configuration',
324+
},
359325
{
360326
title: 'Production Best Practices',
361327
description: 'Learn the best practices of running OpenFGA in a production environment',

docs/sidebars.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,11 @@ const sidebars = {
5151
label: 'Configure OpenFGA',
5252
id: 'content/getting-started/setup-openfga/configure-openfga',
5353
},
54+
{
55+
type: 'doc',
56+
label: 'Configuration Options',
57+
id: 'content/getting-started/setup-openfga/configuration',
58+
},
5459
{
5560
type: 'doc',
5661
label: '🐳 Docker',

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@
2020
"lint": "eslint . --ext .ts --ext .tsx",
2121
"lint:fix": "npm run lint -- --fix",
2222
"format:check": "prettier --check src/**",
23-
"format:fix": "prettier --write src/**"
23+
"format:fix": "prettier --write src/**",
24+
"update:config-page": "node scripts/update-config-page.mjs"
2425
},
2526
"dependencies": {
2627
"@docusaurus/core": "3.6.3",

0 commit comments

Comments
 (0)