-
Notifications
You must be signed in to change notification settings - Fork 46
chore: add page on configuration #546
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+59
−0
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,58 @@ | ||
| import { Tabs } from "nextra/components"; | ||
|
|
||
| # Configuring SpiceDB | ||
|
|
||
| There are several ways to pass runtime flags to SpiceDB. We'll use the `--datastore-conn-pool-read-max-open` flag as an example, | ||
| which is used to control the maximum size of the connection pool for CRDB, Postgres, and MySQL. All of the following configuration | ||
| methods provide the same configuration to SpiceDB. | ||
|
|
||
| ## Command-Line Flags | ||
|
|
||
| You can provide configuration by setting command-line flags on the binary invocation. | ||
| These options are prefixed by `--` and are [kebab-cased](https://developer.mozilla.org/en-US/docs/Glossary/Kebab_case). | ||
|
|
||
| The following are equivalent: | ||
|
|
||
| ```sh | ||
| spicedb serve --datastore-conn-pool-read-max-open 50 | ||
| spicedb serve --datastore-conn-pool-read-max-open=50 | ||
| ``` | ||
|
|
||
| ## Environment Variables | ||
|
|
||
| If an appropriately-named environment variable is available when SpiceDB is invoked, it will use configuration | ||
| from that environment variable. | ||
| These variables are prefixed with `SPICEDB_` and written in `SCREAMING_SNAKE_CASE`. | ||
|
|
||
| ```sh | ||
| export SPICEDB_DATASTORE_CONN_POOL_READ_MAX_OPEN=50 | ||
| spicedb serve | ||
| ``` | ||
|
|
||
| ## SpiceDB Operator Flags | ||
|
|
||
| In the [SpiceDB operator](/spicedb/ops/operator), flags are written in [lowerCamelCase](https://developer.mozilla.org/en-US/docs/Glossary/Camel_case) | ||
| and then are translated to environment variables by the operator. You provide them in the `config` block of the custom resource: | ||
|
|
||
| ```yaml | ||
| spec: | ||
| config: | ||
| datastoreConnPoolReadMaxOpen: 50 | ||
| ``` | ||
|
|
||
| ## dotenv file | ||
|
|
||
| If a file named `spicedb.env` is present in the working directory where the binary is invoked, SpiceDB will read the variable pairs in the file | ||
| and include them as if they were environment variables, similar to [dotenv](https://github.com/motdotla/dotenv). | ||
|
|
||
| <Tabs items={["spicedb.env"]}> | ||
| <Tabs.Tab>```dotenv SPICEDB_DATASTORE_CONN_POOL_READ_MAX_OPEN=50 ```</Tabs.Tab> | ||
| </Tabs> | ||
|
|
||
| ## Precedence | ||
|
|
||
| If multiple configuration methods are present and the values disagree, SpiceDB treats the methods with the following descending order of precedence: | ||
|
|
||
| 1. Command-line flags | ||
| 1. Environment variables | ||
| 1. `spicedb.env` file | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TIL kebab-cased 😆