/
githubmirror
/
ydb-embedded-ui
Обзор
Документация
Войти
/
githubmirror
/
ydb-embedded-ui
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
src/components/ConnectToDB/utils.ts
20 строк
607 B
Артём Муфазалов
feat: add endpoint to connect to db code snippets (#2198)
25 апр 2025, 13:01
Не верифицирован
25 апр 2025, 13:01
6e45802
Код
Авторство
О чём код?
// We have endpoint in format grpc://example.com:2139/?database=/root/test // We need it to be like grpc://example.com:2139 to make code in snippets work // We pass database to snippets as a separate param export function prepareEndpoint(connectionString = '') { try { const urlObj = new URL(connectionString); urlObj.search = ''; let endpoint = urlObj.toString(); // Remove trailing slash if present if (endpoint.endsWith('/')) { endpoint = endpoint.slice(0, -1); } return endpoint; } catch { return undefined; } }