how can I import in relations from the ory cloud to the keto self hosted server?
r
how can I import in relations from the ory cloud to the keto self hosted server?
m
Hello @ripe-wall-60736 You can export your configuration using the CLI : https://www.ory.sh/docs/guides/cli/configure-permission-service
r
Thanks. That worked well for the namespaces. However, for the relations, running:
Copy code
ory list relation-tuples --project=$PROJECT --format=json
which returns:
Copy code
{
  "relation_tuples": [
    {
      "namespace": "User",
      "object": "Samarth",
      "relation": "exists",
      "subject_id": "samarth"
    },
    {
      "namespace": "Accounts",
      "object": "foobar",
      "relation": "edit_rights",
      "subject_id": "samarth"
    }
  ],
  "is_last_page": true,
  "next_page_token": ""
}
. When running
Copy code
keto relation-tuple parse users.json
it returns:
Copy code
--format=json
Could not decode users.json:1
  {"relation_tuples":[{"namespace":"User","object":"Samarth","relation":"exists","subject_id":"samarth"},{"namespace":"Accounts","object":"foobar","relation":"edit_rights","subject_id":"samarth"}],"is_last_page":true,"next_page_token":""}

malformed string input
I am stuck here so to speak
@magnificent-energy-493 ping
m
I am not sure if this Keto command works here 🤔 Do you know maybe @steep-lamp-91158?
s
r
I see, thanks. Will test out soon
Running:
Copy code
ory list relation-tuples --project=$PROJECT --format=table
gives
Copy code
NAMESPACE       OBJECT  RELATION NAME   SUBJECT
User            Samarth exists          samarth
Accounts        foobar  edit_rights     samarth

NEXT PAGE TOKEN
IS LAST PAGE    true
Which I then pipe to a file (relations.tb) When I run
Copy code
keto relation-tuple parse relations.tb --format=table
it returns:
Copy code
Could not decode relations.tb:1
  NAMESPACE     OBJECT  RELATION NAME   SUBJECT

malformed string input
also, what is the blessed way to compile the ory permissions langauge down to the JSON that keto seems to use?
@magnificent-energy-493 sorry to bother you like this...
s
Copy code
ory list relation-tuples --project=... --format=json | jq .relation_tuples | keto relation-tuples create -
should work
just do not use parse, it is meant for the string format used in docs
you don't need to compile anything, just set the config
Copy code
namespaces: location: <file://path/to/your/namespaces.ts>
r
I see. Thanks!