diff --git a/.env.marketplace.template b/.env.marketplace.template index eaca0411..949a8018 100644 --- a/.env.marketplace.template +++ b/.env.marketplace.template @@ -2,3 +2,5 @@ S3_ENDPOINT=http://localhost:9000 S3_BUCKET=fastgpt-plugins S3_ACCESS_KEY=minioadmin S3_SECRET_KEY=minioadmin +MARKETPLACE_BASE_URL=http://localhost:3100 +MARKETPLACE_AUTH_TOKEN=token diff --git a/scripts/deploy-marketplace.ts b/scripts/deploy-marketplace.ts index 52605496..4270182a 100644 --- a/scripts/deploy-marketplace.ts +++ b/scripts/deploy-marketplace.ts @@ -119,6 +119,23 @@ async function main() { await client.write(`/pkgs.zip`, Bun.file('./dist/pkgs.pkg')); console.log('✅ pkgs.zip uploaded successfully'); + + if (!process.env.MARKETPLACE_BASE_URL || !process.env.MARKETPLACE_AUTH_TOKEN) { + console.error('❌ Missing required environment variables:'); + if (!process.env.MARKETPLACE_BASE_URL) console.error(' - MARKETPLACE_BASE_URL'); + if (!process.env.MARKETPLACE_AUTH_TOKEN) console.error(' - MARKETPLACE_AUTH_TOKEN'); + process.exit(1); + } + + console.log('🚀 Starting marketplace update...'); + + // update marketplace + await fetch(`${process.env.MARKETPLACE_BASE_URL}/api/admin/refresh`, { + method: 'GET', + headers: { + Authorization: process.env.MARKETPLACE_AUTH_TOKEN + } + }); } if (import.meta.main) {