Fix Cloudflare config persistence

This commit is contained in:
Alex Gleason committed 2025-12-03 21:21:30 -06:00
1 parent 9017c5c382
commit cc8a02a564
4 files changed
+71 -60

No files matched your search

+7
View File
@@ -228,6 +228,13 @@ describe('configUtils', () => {
name: 'Shakespeare',
type: 'shakespeare',
},
{
id: 'provider-4',
name: 'My Cloudflare',
type: 'cloudflare',
apiKey: 'cloudflare-token-789',
accountId: 'account-123',
},
],
};
+8
View File
@@ -106,11 +106,19 @@ const nsiteProviderSchema = baseDeployProviderSchema.extend({
blossomServers: z.array(z.string()),
});
const cloudflareProviderSchema = baseDeployProviderSchema.extend({
type: z.literal('cloudflare'),
apiKey: z.string(),
accountId: z.string(),
baseURL: z.string().optional(),
});
const deployProviderSchema: z.ZodType<DeployProvider> = z.discriminatedUnion('type', [
shakespeareDeployProviderSchema,
netlifyProviderSchema,
vercelProviderSchema,
nsiteProviderSchema,
cloudflareProviderSchema,
]);
const deploySettingsSchema = z.object({
+4 -8
View File
@@ -77,14 +77,9 @@ export class CloudflareAdapter implements DeployAdapter {
// Construct the production URL
// The subdomain from the API response already includes the full domain
// e.g., "error-button.pages.dev" not just "error-button"
let productionUrl: string;
if (project.subdomain.includes('.')) {
// Subdomain already includes the domain
productionUrl = `https://${project.subdomain}`;
} else {
// Subdomain is just the name, append .pages.dev
productionUrl = `https://${project.subdomain}.pages.dev`;
}
const productionUrl = project.subdomain.includes('.')
? `https://${project.subdomain}`
: `https://${project.subdomain}.pages.dev`;
return {
url: deployment.url,
@@ -92,6 +87,7 @@ export class CloudflareAdapter implements DeployAdapter {
deploymentId: deployment.id,
projectId: project.id,
projectName: project.name,
productionUrl,
provider: 'cloudflare',
environment: deployment.environment,
},