跳至內容
選單
此問題已被標幟
1 回覆
153 瀏覽次數

Dear Community,

We’re currently implementing Odoo on Odoo.sh for a client, with the goal of enhancing certain data flows using AI agents. For this we need API keys, and I’d like to clarify the best practices around managing them across environments.

I’m already familiar with the stages, branches, and build logic of Odoo.sh. In production and staging, I created a dedicated user and generated an API key, which works fine.

My main question is about the testing environment. Since Odoo.sh rebuilds the environment from scratch, what is the recommended approach to ensure stable API access?

  • Should I use the testing branch to test API connections, or is there a better workflow?
  • If API access is possible in testing, which user account should be used: the default admin or a separate dedicated account?

Any advice or best practices from your experience would be greatly appreciated.

Thank you in advance!

頭像
捨棄
最佳答案

Hi,


When using Odoo.sh, API keys are tied to user accounts, not the instance itself. This means that whenever a testing environment is rebuilt, any manually created keys will be lost unless you migrate them. For that reason, it’s important to plan how API users and keys are managed across production, staging, and testing.


The best practice is to create a dedicated technical user for API access instead of using the default admin account. This makes it easier to control permissions, audit usage, and revoke or rotate keys when needed. Ideally, you should maintain separate API users for production and for testing/staging, so production data is never exposed during development.


In Odoo.sh testing environments, it’s not reliable to create keys manually since they won’t persist after rebuilds. Instead, keys should either be injected through environment variables or automatically provisioned using a bootstrap script or module that creates the API user and key during deployment. This ensures your developers always have consistent test credentials without manual setup.


Finally, the staging branch is the most suitable place for realistic API testing, because it contains a persistent copy of the production database. The testing branch, being short-lived, should only be used with injected or automatically created test credentials. This approach keeps production keys safe while still enabling stable API access for testing and development.



Hope it helps

頭像
捨棄
相關帖文 回覆 瀏覽次數 活動
2
3月 25
7090
0
5月 25
3052
1
8月 23
2366
0
11月 21
3385
4
10月 25
365