FitnessApp/lib/service-address.ts

12 lines
326 B
TypeScript

/** Display the configured endpoint without usernames, passwords, or URL queries. */
export function getServiceAddress(value: string | undefined): string {
if (!value) return 'Not configured';
try {
const url = new URL(value);
return url.host || 'Invalid address';
} catch {
return 'Invalid address';
}
}