Handling API Tokens and Webhooks in a dockerized Strapi project

System Information
  • Strapi Version: 4.15.4
  • Operating System: —
  • Database: MySQL
  • Node Version: v18.17.1
  • NPM Version: 9.6.7
  • Yarn Version: —

I’m working on a project that uses Strapi + MySQL as an API to generate a static website with Eleventy. I have everything working on my local machine, and I’m wondering if it’s possible to create a Docker image for the entire setup. The idea is a set of containers in communication with each other and mounted with a docker-compose.yml. As the database is already filled, there is a line in the docker-compose.yml to properly copy and import the data to the new database.

The problem that I’m dealing with now is the fact that the process of fetching data in Eleventy and rebuilding the website relies on an API Token and a Webhook generated by Strapi. Apparently, it isn’t possible to export API Tokens and Webhooks using the Strapi CLI export. On the other hand, there’s no CLI command to generate API Tokens and Webhooks at the build time of the container.

How can I deal with it in these conditions? Maybe there’s an easy way that I’m not considering right now. These processes are pretty new to me, and I’m looking for a solution that makes it easy to deploy the website on a variety of production environments.

1 Like

Have the same use case, tried to use bootstrap but the api to create API Tokens doesn’t allow you to specify the secret in advance

1 Like