refactor(databases): show ip in external connection instead of hostname

This commit is contained in:
Mauricio Siu
2024-07-20 15:23:44 -06:00
parent 60d6d781be
commit f36de7b2f5
6 changed files with 14 additions and 8 deletions

View File

@@ -44,6 +44,7 @@ interface Props {
redisId: string;
}
export const ShowExternalRedisCredentials = ({ redisId }: Props) => {
const { data: ip } = api.settings.getIp.useQuery();
const { data, refetch } = api.redis.one.useQuery({ redisId });
const { mutateAsync, isLoading } = api.redis.saveExternalPort.useMutation();
const [connectionUrl, setConnectionUrl] = useState("");
@@ -80,7 +81,7 @@ export const ShowExternalRedisCredentials = ({ redisId }: Props) => {
const hostname = window.location.hostname;
const port = form.watch("externalPort") || data?.externalPort;
return `redis://default:${data?.databasePassword}@${hostname}:${port}`;
return `redis://default:${data?.databasePassword}@${ip}:${port}`;
};
setConnectionUrl(buildConnectionUrl());