dashboard: fix toaster

This commit is contained in:
Carl-Gerhard Lindesvärd
2024-02-12 07:43:33 +01:00
parent 6f2aeffdff
commit 5afc49b7e4
20 changed files with 49 additions and 266 deletions

View File

@@ -1,12 +1,9 @@
const parse = (connectionString: string) => {
const match = connectionString.match(/redis:\/\/(.+?):(.+?)@(.+?):(.+)/);
if (!match) {
throw new Error('Invalid connection string');
}
const url = new URL(connectionString);
return {
host: match[3]!,
port: Number(match[4]),
password: match[2]!,
host: url.hostname,
port: Number(url.port),
password: url.password,
} as const;
};