Configuration
Exograph tooling can be configured using an exo.toml
file in the root directory of your project, such as:
[exograph]
version = "0.11.1"
[build]
after-model-change = [
"exo graphql schema --output ../web/.gen/graphql/schema.graphql",
"exo schema migrate --allow-destructive-changes -o migrations/current.sql"
]
You can express the content in an alternative TOML format. For example, the above configuration can be expressed as:
exograph.version = "0.11.1"
build.after-model-change = [
"exo graphql schema --output ../web/.gen/graphql/schema.graphql",
"exo schema migrate --allow-destructive-changes -o migrations/current.sql"
]
The configuration file supports the exograph
and build
, dev
, and yolo
configuration sections.
exograph
You can specify the required version of the Exograph CLI using the exograph.version
key.
A typical exograph
configuration looks like:
[exograph]
version = "0.11.1"
You can specify the version using as much specificity as you want. Here are some examples (along with the accepted Exograph CLI versions):
Specification | Description |
---|---|
version = "0.11.1" | Exactly 0.11.1 |
version = "=0.11.1" | Exactly 0.11.1 |
version = "^1.2.3" | Higher than 1.2.3, lower than 2.0.0 |
version = "~1.2.3" | Higher than 1.2.3, lower than 1.3.0 |
version = "1" | Higher than 1.0.0, lower than 2.0.0 |
version = ">=0.11.1" | Higher than or equal to 0.11.1 |
version = "<0.11.1" | Lower than 0.11.1 |
Currently, Exograph does not support the ||
operator in the version specification.
Until Exograph reaches version 1.0, we recommend the exact version specification (e.g., version = "=0.11.1"
) or the minimal version with a patch version (e.g., version = "> 0.11.1"
).
build
, dev
, and yolo
You can declare hooks to run during the lifecycle of the build, dev, and yolo commands.
When the specified commands run as follows:
build
: The commands run after the model has been built (such as directly building usingexo build
or indirectly building as part ofexo dev
orexo yolo
).dev
: The commands run when the server is restarted in the dev mode.yolo
: The commands run when the server is restarted in the yolo mode.
For example, if you want to generate the GraphQL schema upon model changes automatically, you can use the following configuration:
[build]
after-model-change = [
"exo graphql schema --output ../web/.gen/graphql/schema.graphql",
]
During development, you may want to keep track of migrations that you will eventually need to apply to your staging or production database. You can do this by adding the following configuration:
[dev]
after-model-change = [
"EXO_POSTGRES_URL=<staging-or-production-database-url> exo schema migrate --allow-destructive-changes -o migrations/current.sql"
]