From 4095031db8aeee44415e48ae5feedd9bb674aaac Mon Sep 17 00:00:00 2001 From: "guilhem.carron" <gcarron@grandlyon.com> Date: Thu, 22 Jul 2021 11:13:23 +0200 Subject: [PATCH] Add a secret to remote doctype --- docs/ecolyo/project_architecture/remote_doctypes.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/docs/ecolyo/project_architecture/remote_doctypes.md b/docs/ecolyo/project_architecture/remote_doctypes.md index afb3011..852782c 100644 --- a/docs/ecolyo/project_architecture/remote_doctypes.md +++ b/docs/ecolyo/project_architecture/remote_doctypes.md @@ -129,3 +129,16 @@ const result = await client ``` If you wanna know more about remote doctypes and how to store and use secret tokens, please refer to the official cozy documentation. + +## Add secrets to a remote + +As above, you can pass a _{{secret_token}}_ to your remote doctype. In local, you can directly pass it as a request param in _io.cozy.doctypes/org.ecolyo.usage_. +Otherwise, you will have to add it in the shell script _easy-cozy/db-init.sh_ on the server. You can add the following line to the file in order to add the secret in the database : + +``` +docker-compose exec db curl -X PUT -d "{\"_id\":\"org.ecolyo.dju\",\"token\":\"${API_DATAGRANDLYON_TOKEN}\"}" http://127.0.0.1:5984/secrets%2Fio-cozy-remote-secrets/org.ecolyo.dju +``` + +Make sure you have the right remote doctype name as \_id. + +Then, in the .env file, just add your token variable. -- GitLab