Skip to main content

Configure projects with Ory CLI

All Ory components use the same configuration format and APIs whether they are self-hosted or used through Ory Network.

This allows you to use the Ory CLI to configure your components, no matter how you use Ory!

note

This feature is currently in development. More configuration options are added with new CLI releases

Configure projects

There are two ways to adjust the configuration of projects. You can:

  • overwite / import configuration from a file using the ory update command
  • patch the existing configuration using the ory patch command

Overwrite / import configuration

To overwrite the entire project configuration or to import a brand new config, create a file with the configuration you want to use.

The configuration format follows the updateProject API request payload.

note

The /services/identity/config key is compatible with the Ory Kratos configuration format except for some keys (for example serve, dsn) which are ignored.

{
"services": {
"identity": {
"config": ...
}
}
}

Let's look at an example. If you want to change the name of the email sender for recovery and verification emails, create a configuration file that looks like this:

config.json
{
"name": "My Project Name"
"services": {
"identity": {
"config": {
"courier": {
"smtp": {
"from_name": "My Custom E-Mail Name"
}
}
}
}
}
}

Next, use the Ory CLI to apply the config:

ory update project <your-project-id> --file config.json

Patch configuration

When you want to change specific parts of the configuration instead of overwriting the entire config, use the ory patch command.

Use this command in combination with JSON Patch to target individual keys.

To perform an update similar to the one described in the previous paragraph and change the name of the email sender for recovery and verification emails, run this command:

ory patch project <your-project-id> \
--replace '/services/identity/config/courier/smtp/from_name="My Custom E-Mail Name"'

Use the --replace flag to indicate the key you want to change.

tip

When patching configuration, the part after = is interpreted as raw JSON. Use these format to patch the desired data types:

  • String: /path/to/key="my string"
  • Boolean: /path/to/key=true
  • Number: /path/to/key=123
  • Complex: /path/to/key={"my": ["vaules", {"foo":"bar"}]}