Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

chore: custom ssl cert url (#38464)

Alaister Young8b3179ea26b7
diff --git a/apps/studio/components/interfaces/Settings/Database/SSLConfiguration.tsx b/apps/studio/components/interfaces/Settings/Database/SSLConfiguration.tsx
index 52990b97e1e..70d151e18ca 100644
--- a/apps/studio/components/interfaces/Settings/Database/SSLConfiguration.tsx
+++ b/apps/studio/components/interfaces/Settings/Database/SSLConfiguration.tsx
@@ -1,7 +1,8 @@
import { PermissionAction } from '@supabase/shared-types/out/constants'
+import { template } from 'lodash'
import { Download, Loader2 } from 'lucide-react'
import Link from 'next/link'
-import { useEffect, useState } from 'react'
+import { useEffect, useMemo, useState } from 'react'
import { toast } from 'sonner'
import { useParams } from 'common'
@@ -13,6 +14,7 @@ import { FormSection, FormSectionContent, FormSectionLabel } from 'components/ui
import { useProjectSettingsV2Query } from 'data/config/project-settings-v2-query'
import { useSSLEnforcementQuery } from 'data/ssl-enforcement/ssl-enforcement-query'
import { useSSLEnforcementUpdateMutation } from 'data/ssl-enforcement/ssl-enforcement-update-mutation'
+import { useCustomContent } from 'hooks/custom-content/useCustomContent'
import { useAsyncCheckProjectPermissions } from 'hooks/misc/useCheckPermissions'
import { useSelectedProjectQuery } from 'hooks/misc/useSelectedProject'
import { Alert, Button, Switch, Tooltip, TooltipContent, TooltipTrigger } from 'ui'
@@ -65,6 +67,12 @@ const SSLConfiguration = () => {
const hasSSLCertificate =
settings?.inserted_at !== undefined && new Date(settings.inserted_at) >= new Date('2021-04-30')
+ const { sslCertificateUrl: sslCertificateUrlTemplate } = useCustomContent(['ssl:certificate_url'])
+ const sslCertificateUrl = useMemo(
+ () => template(sslCertificateUrlTemplate ?? '')({ env }),
+ [sslCertificateUrlTemplate, env]
+ )
+
useEffect(() => {
if (!isLoading && sslEnforcementConfiguration) {
setIsEnforced(initialIsEnforced)
@@ -183,11 +191,7 @@ const SSLConfiguration = () => {
</ButtonTooltip>
) : (
<Button type="default" icon={<Download />}>
- <a
- href={`https://supabase-downloads.s3-ap-southeast-1.amazonaws.com/${env}/ssl/${env}-ca-2021.crt`}
- >
- Download certificate
- </a>
+ <a href={sslCertificateUrl}>Download certificate</a>
</Button>
)}
</div>
diff --git a/apps/studio/hooks/custom-content/CustomContent.types.ts b/apps/studio/hooks/custom-content/CustomContent.types.ts
index 28568d054b3..b05e0ee0e7b 100644
--- a/apps/studio/hooks/custom-content/CustomContent.types.ts
+++ b/apps/studio/hooks/custom-content/CustomContent.types.ts
@@ -29,4 +29,6 @@ export type CustomContentTypes = {
connectFrameworks: (typeof CONNECTION_TYPES)[number]
infraCloudProviders: CloudProvider[]
+
+ sslCertificateUrl: string
}
diff --git a/apps/studio/hooks/custom-content/custom-content.json b/apps/studio/hooks/custom-content/custom-content.json
index 57bd6db86b7..3c5c0677783 100644
--- a/apps/studio/hooks/custom-content/custom-content.json
+++ b/apps/studio/hooks/custom-content/custom-content.json
@@ -9,5 +9,7 @@
"connect:frameworks": null,
- "infra:cloud_providers": ["AWS", "AWS_K8S", "FLY"]
+ "infra:cloud_providers": ["AWS", "AWS_K8S", "FLY"],
+
+ "ssl:certificate_url": "https://supabase-downloads.s3-ap-southeast-1.amazonaws.com/${env}/ssl/${env}-ca-2021.crt"
}
diff --git a/apps/studio/hooks/custom-content/custom-content.sample.json b/apps/studio/hooks/custom-content/custom-content.sample.json
index da5a880f342..18730c60dd3 100644
--- a/apps/studio/hooks/custom-content/custom-content.sample.json
+++ b/apps/studio/hooks/custom-content/custom-content.sample.json
@@ -74,5 +74,7 @@
]
},
- "infra:cloud_providers": ["AWS_NIMBUS"]
+ "infra:cloud_providers": ["AWS_NIMBUS"],
+
+ "ssl:certificate_url": "https://supabase-downloads.s3-ap-southeast-1.amazonaws.com/${env}/ssl/${env}-ca-2021.crt"
}
diff --git a/apps/studio/hooks/custom-content/custom-content.schema.json b/apps/studio/hooks/custom-content/custom-content.schema.json
index adea1a5f9fe..90f41a81940 100644
--- a/apps/studio/hooks/custom-content/custom-content.schema.json
+++ b/apps/studio/hooks/custom-content/custom-content.schema.json
@@ -81,6 +81,11 @@
"type": "string",
"enum": ["AWS", "AWS_K8S", "AWS_NIMBUS", "FLY"]
}
+ },
+
+ "ssl:certificate_url": {
+ "type": "string",
+ "description": "The URL of the SSL certificate"
}
},
"required": [
@@ -88,7 +93,8 @@
"project_homepage:example_projects",
"logs:default_query",
"connect:frameworks",
- "infra:cloud_providers"
+ "infra:cloud_providers",
+ "ssl:certificate_url"
],
"additionalProperties": false
}