import { isAdmin } from '@/lib/utils' import { Separator } from '@/components/ui/separator' import { Button } from '@/components/ui/button' import { redirectPage } from '@nanostores/router' import { $router } from '@/components/router' import { AlertCircleIcon, FileSlidersIcon, LoaderCircleIcon } from 'lucide-react' import { Alert, AlertDescription, AlertTitle } from '@/components/ui/alert' import { pb } from '@/lib/stores' import { useState } from 'react' import { Textarea } from '@/components/ui/textarea' import { toast } from '@/components/ui/use-toast' import clsx from 'clsx' export default function ConfigYaml() { const [configContent, setConfigContent] = useState('') const [isLoading, setIsLoading] = useState(false) const ButtonIcon = isLoading ? LoaderCircleIcon : FileSlidersIcon async function fetchConfig() { try { setIsLoading(true) const { config } = await pb.send<{ config: string }>('/api/beszel/config-yaml', {}) setConfigContent(config) } catch (error: any) { toast({ title: 'Error', description: error.message, variant: 'destructive', }) } finally { setIsLoading(false) } } if (!isAdmin()) { redirectPage($router, 'settings', { name: 'general' }) } return (

YAML Configuration

Export your current systems configuration.

Systems may be managed in a{' '} config.yml file inside your data directory.

On each restart, systems in the database will be updated to match the systems defined in the file.

Caution - potential data loss

Existing systems not defined in config.yml will be deleted. Please make regular backups.

{configContent && (