mirror of
https://gitlab.com/soapbox-pub/shakespeare.git
synced 2026-12-05 16:23:36 +00:00
Fix Cloudflare config persistence
This commit is contained in:
4 files changed
+71
-60
No files matched your search
@@ -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',
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
|
||||
@@ -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({
|
||||
|
||||
@@ -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,
|
||||
},
|
||||
|
||||
Reference in new issue
Block a user