<@U04UQ68083H> how to query for relationships with...
# ory-copilot
b
@chilly-king-10285 how to query for relationships with subject set. For example
ory list relationships --project our-project --subject Customer:example-customer#members
b
A message from kapa.ai
A message from kapa.ai
New message text here
To query for relationships with a subject set using the Ory CLI, you can use the
ory list relationships
command with the
--subject-set
flag. The
--subject-set
flag should be followed by the subject set in the format "namespace:object#relation". Here is an example command based on your question:
Copy code
bash ory list relationships --project our-project --subject-set "Customer:example-customer#members"
This command will list all relation tuples that match the given partial tuple for the project "our-project" and the subject set "Customer:example-customer#members". You can also specify other options such as
--namespace
,
--object
,
--relation
,
--subject-id
,
--page-size
,
--page-token
to further filter the results. For more details, you can refer to the [Ory CLI documentation](https://www.ory.sh/docs/cli/ory-list-relationships).
b
@chilly-king-10285 Does ory support passing an api key for service to service auth cases?
b
A message from kapa.ai
Yes, Ory does support passing an API key for service-to-service authentication cases. This is particularly useful in automated environments like CI/CD pipelines. The Ory CLI supports both workspace and project API keys. Workspace API keys have permissions to manage project configs, while project API keys have permissions to manage project data. Depending on the use-case you might need to use one or both. You can set the API keys using the
ORY_WORKSPACE_API_KEY
and
ORY_PROJECT_API_KEY
environment variables:
Copy code
bash export ORY_WORKSPACE_API_KEY=ory_wak_8dwW9s....   export ORY_PROJECT_API_KEY=ory_pt_Wse93s....
When calling the API, include the API Key in the
Authorization
header:
Copy code
bash GET /projects/$PROJECT_ID HTTP/1.1   Host: api.console.ory.sh   Accept: application/json   Authorization: Bearer $API_KEY
For more information, you can refer to the [Ory CLI documentation](https://www.ory.sh/docs/guides/cli/cli-basics#authentication) and [Ory Network API Keys documentation](https://www.ory.sh/docs/concepts/personal-access-token#usage-1).
b
@chilly-king-10285 If I wanted to manage my project entirely with gitops, what things would I need to my gitops operator to manage? The identity config, the permission config, what else?
b
A message from kapa.ai
To manage your Ory project entirely with GitOps, you would need your GitOps operator to manage the following configurations: 1. Identity Config: This configuration is used to manage the identity schemas in your project. You can pull the current configuration using the
ory get identity-config
command and update it using the
ory update identity-config
command. [source](https://www.ory.sh/docs/guides/gitops#ory-network-configuration) 2. OAuth2 & OpenID Connect Config: This configuration is used to manage the OAuth2 & OpenID Connect settings in your project. You can pull the current configuration using the
ory get oauth2-config
command and update it using the
ory update oauth2-config
command. [source](https://www.ory.sh/docs/guides/gitops#ory-oauth2--openid-connect-configuration) 3. Permissions Config and Ory Permission Language (OPL) Config: These configurations are used to manage the permissions in your project. You can pull the current configuration using the
ory get permission-config
command and update it using the
ory update permission-config
command. For the OPL configuration, you can update it using the
ory update opl
command. [source](https://www.ory.sh/docs/guides/gitops#ory-permissions-configuration-and-ory-permission-language) In addition to these, you might also need to manage the following, depending on your project's requirements: - Event Stream Config - OAuth2 Client Config - Organization Config - Project Config You can update these configurations using the
ory update
command followed by the respective configuration name. [source](https://www.ory.sh/docs/guides/cli/cli-migration-v1#migrate-existing-scripts-and-automation) Remember, all these configurations should be stored in a version control system like Git, and changes to these configurations should be made through pull requests. When a pull request is merged, the configuration will be updated automatically in your Ory project.
b
@chilly-king-10285 where would I get the config to supply to the
ory create project -c <config>
command?
b
A message from kapa.ai
The configuration file for the
ory create project -c <config>
command should be a JSON file that contains the configuration settings for your new project. You can create this file manually, following the structure of the [updateProject API request payload](https://www.ory.sh/docs/reference/api#operation/updateProject). The
/services/identity/config
key is compatible with the [Ory Kratos configuration format](https://www.ory.sh/docs/kratos/reference/configuration) except for some keys (for example
serve
,
dsn
) which are ignored. Here's an example of what the configuration file might look like:
Copy code
json {     "name": "My Project Name",     "services": {       "identity": {         "config": {           "courier": {             "smtp": {               "from_name": "My Custom E-Mail Name"             }           }         }       }     }   }
In this example, the project name is set to "My Project Name", and the email sender name for recovery and verification emails is set to "My Custom E-Mail Name". Once you have created your configuration file, you can use it with the
ory create project -c <config>
command like this:
Copy code
bash ory create project -c config.json
This command will create a new project with the configuration settings specified in the
config.json
file.