feat: new secrets

This commit is contained in:
2026-07-20 15:23:16 +02:00
parent 5a6833c1a2
commit 3fff09ba81
18 changed files with 121 additions and 109 deletions
+5 -5
View File
@@ -8,7 +8,7 @@ const { randomUUID } = require('crypto')
const { ALERT_TYPE, refList } = require('../index')
const { sendNotification } = require('./notifications')
const { createOrderDocument, ORDER_TYPES } = require('./helpers/orders')
const { SUNO_API_KEY } = require('../config/keys')
const { SUNO_API_KEY } = require('../config/secrets')
const {
SUNO_MODEL,
SUNO_CALLBACK_URL,
@@ -468,7 +468,7 @@ const mergeMusicUrls = async (projectRef, newUrls) => {
// 5. FONCTIONS PRINCIPALES (CLOUD FUNCTIONS)
// ==========================================
exports.generateMusic = onCall(async ({ data = {} }) => {
exports.generateMusic = onCall({ secrets: [SUNO_API_KEY] }, async ({ data = {} }) => {
try {
// Extraction des données du Frontend
const {
@@ -542,7 +542,7 @@ exports.generateMusic = onCall(async ({ data = {} }) => {
const response = await axios.post(`${SUNO_API_BASE}${SUNO_API_PATH}`, payload, {
headers: {
'Content-Type': 'application/json',
Authorization: `Bearer ${SUNO_API_KEY}`,
Authorization: `Bearer ${SUNO_API_KEY.value()}`,
},
})
@@ -571,12 +571,12 @@ exports.generateMusic = onCall(async ({ data = {} }) => {
})
// GET STATUS (inchangé mais inclus pour complétude)
exports.getSunoStatus = onCall(async ({ data = {} }) => {
exports.getSunoStatus = onCall({ secrets: [SUNO_API_KEY] }, async ({ data = {} }) => {
const { taskId } = data
if (!taskId) throw new Error('TaskId manquant')
try {
const response = await axios.get(`${SUNO_API_BASE}${SUNO_STATUS_PATH}?taskId=${taskId}`, {
headers: { Authorization: `Bearer ${SUNO_API_KEY}` },
headers: { Authorization: `Bearer ${SUNO_API_KEY.value()}` },
timeout: 30000,
})
return {