Utiliser le chemin /organisations/{orgaId}/ pour l'API Clever Cloud
This commit is contained in:
parent
106c04b91a
commit
18691d930e
3 changed files with 6 additions and 2 deletions
|
|
@ -10,5 +10,7 @@ PUBLIC_STORYBLOK_TOKEN=
|
|||
# STORYBLOK_WEBHOOK_SECRET=
|
||||
# Token OAuth Clever Cloud (généré via clever login puis ~/.config/clever-cloud/clever-tools.json)
|
||||
# CLEVER_TOKEN=
|
||||
# ID de l'organisation Clever Cloud (orga_xxxxxxxx)
|
||||
# CLEVER_ORGA_ID=
|
||||
# ID de l'application Clever Cloud de production (app_xxxxxxxx)
|
||||
# CLEVER_APP_ID_PRODUCTION=
|
||||
|
|
|
|||
|
|
@ -51,6 +51,7 @@ Le serveur démarre sur le port `8080` par défaut (configurable via `PORT`).
|
|||
| `PUBLIC_STORYBLOK_IS_PREVIEW` | *(non défini)* | `true` |
|
||||
| `STORYBLOK_WEBHOOK_SECRET` | - | Secret du webhook StoryBlok |
|
||||
| `CLEVER_TOKEN` | - | Token OAuth Clever Cloud |
|
||||
| `CLEVER_ORGA_ID` | - | ID de l'organisation (orga_xxx) |
|
||||
| `CLEVER_APP_ID_PRODUCTION` | - | ID de l'app production (app_xxx) |
|
||||
| `CC_POST_BUILD_HOOK` | `npm run build` | `npm run build` |
|
||||
| `HOST` | - | `0.0.0.0` |
|
||||
|
|
|
|||
|
|
@ -4,9 +4,10 @@ import { createHmac, timingSafeEqual } from 'node:crypto';
|
|||
export const POST: APIRoute = async ({ request }) => {
|
||||
const webhookSecret = import.meta.env.STORYBLOK_WEBHOOK_SECRET;
|
||||
const token = import.meta.env.CLEVER_TOKEN;
|
||||
const orgaId = import.meta.env.CLEVER_ORGA_ID;
|
||||
const appId = import.meta.env.CLEVER_APP_ID_PRODUCTION;
|
||||
|
||||
if (!webhookSecret || !token || !appId) {
|
||||
if (!webhookSecret || !token || !orgaId || !appId) {
|
||||
return new Response('Missing server configuration', { status: 500 });
|
||||
}
|
||||
|
||||
|
|
@ -19,7 +20,7 @@ export const POST: APIRoute = async ({ request }) => {
|
|||
}
|
||||
|
||||
const response = await fetch(
|
||||
`https://api-bridge.clever-cloud.com/v2/self/applications/${appId}/instances`,
|
||||
`https://api-bridge.clever-cloud.com/v2/organisations/${orgaId}/applications/${appId}/instances`,
|
||||
{
|
||||
method: 'POST',
|
||||
headers: { Authorization: `Bearer ${token}` },
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue