Setting the api key via console

Is there a way to set the main api key via the console?

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.

@pfaffman 님, 앱 안에서 이 단계를 어떻게 따라가야 하나요? 즉, ./launcher로 앱에 진입한 후, 말씀하신 이 명령어들을 어떻게 사용해야 하는지 궁금합니다.

rake api_key:get만 실행하면 될 것 같습니다. 한번 시도해 보세요. 해당 명령어를 자세히 확인해 보진 않아서 필요한 매개변수가 있는지 확실하지 않습니다.

답변 감사합니다. 이 링크의 해결책으로 제 문제를 해결했습니다: Locked out of admin account after disabling SSO Memberful - #5 by Thamer

명령어, 앱 명령어 등에 대해 더 자세히 알아볼 수 있는 곳이 있을까요? 기본적인 정보를 찾는 것이 쉽지 않고, 필요할 때 문제를 해결하는 것도 어렵습니다.

다음과 같이 실행해 보세요.

./launcher enter app 
 rake api_key:get

관리자 일괄 작업 문서를 참고해 보시는 것도 좋습니다.