Is there a way to set the main api key via the console?
AI-generated summary
The discussion revolves around setting the API key via the console in a Discourse instance. pfaffman provides a command using rake api_key:get to retrieve or set the API key if it’s not already set. csmu clarifies that the command both gets and sets the key, and pfaffman confirms the key persists if the database is retained. Thamer asks how to run the command inside the app container after ./launcher enter app, and justin suggests running rake api_key:get directly. pfaffman recommends checking the Administrative Bulk Operations guide for more information on app commands.
YML=app
SSH_USER=root@host
API_KEY=`ssh $SSH_USER sudo docker exec -w /var/www/discourse -i $YML rake api_key:get`
Does this get or set the api?
It does both. It sets it if it’s not set already.
Is the api key being passed in and used or is rake api_key:get creating one if one does not exist?
Context is rebuilding an instance and keeping the old api key.
If the database persists then the API key persists.
Cool. So it’s in the database somewhere.
Context is building from scratch and testing the importing routines.
Thanks Jay, cheers!
Have a look at the rake task in lib/tasks/api_key.
Hey @pfaffman, how can I follow these steps inside the app?? I mean after ./launcher enter app, how can I use these commands you mentioned?
Should be able to do just rake api_key:get — give that a go. I haven’t looked at the command so I’m uncertain if there are any parameters you need.
Thanks for your reply, I did solve my problem via this solution here Locked out of admin account after disabling SSO Memberful - #5 by Thamer
Regarding commands, app commands, and so on, where can I learn more about it? It is being tough to find some basic information and hard to solve problems when I need to.