feat: add Honcho Cloud connection preset
Adds a "choose-type" step to the settings flow so users can pick between Honcho Cloud (https://api.honcho.dev, API key required) and Self-Hosted (URL + optional token) when creating a connection. Multi-instance support already exists in the data layer, so cloud and self-hosted instances can coexist. - new HONCHO_CLOUD_URL constant and isCloudInstance helper in config.ts - SettingsForm accepts a preset prop; cloud variant locks the endpoint and enforces an API key - InstancesManager gains a ConnectionTypeChooser entry point and renders a Cloud icon for cloud instances in the list - unit tests for both preset paths and cloud edit-mode detection
This commit is contained in:
@@ -4,6 +4,16 @@ import { httpFetch } from "@/lib/http";
|
||||
const LEGACY_KEY = "openconcho:config";
|
||||
const STORE_KEY = "openconcho:instances";
|
||||
|
||||
export const HONCHO_CLOUD_URL = "https://api.honcho.dev";
|
||||
|
||||
function normalizeBaseUrl(url: string): string {
|
||||
return url.trim().replace(/\/+$/, "").toLowerCase();
|
||||
}
|
||||
|
||||
export function isCloudInstance(instance: Pick<Instance, "baseUrl">): boolean {
|
||||
return normalizeBaseUrl(instance.baseUrl) === HONCHO_CLOUD_URL;
|
||||
}
|
||||
|
||||
export const configSchema = z.object({
|
||||
baseUrl: z.string().url({ message: "Must be a valid URL" }),
|
||||
token: z.string().optional().default(""),
|
||||
|
||||
Reference in New Issue
Block a user