fix: show ip address as host in public dbs

This commit is contained in:
Andras Bacsai 2023-03-07 13:25:08 +01:00
parent 470ff49a02
commit 02ba277a86
3 changed files with 51 additions and 29 deletions

View File

@ -15,11 +15,11 @@ import * as SSHConfig from 'ssh-config/src/ssh-config';
import jsonwebtoken from 'jsonwebtoken';
import { checkContainer, removeContainer } from './docker';
import { day } from './dayjs';
import { saveBuildLog, saveDockerRegistryCredentials } from './buildPacks/common';
import { saveBuildLog } from './buildPacks/common';
import { scheduler } from './scheduler';
import type { ExecaChildProcess } from 'execa';
export const version = '3.12.26';
export const version = '3.12.27';
export const isDev = process.env.NODE_ENV === 'development';
export const proxyPort = process.env.COOLIFY_PROXY_PORT;
export const proxySecurePort = process.env.COOLIFY_PROXY_SECURE_PORT;

View File

@ -49,23 +49,23 @@
databaseDbUser = '';
}
}
function generateUrl() {
const ipAddress = () => {
if ($status.database.isPublic) {
if (database.destinationDocker.remoteEngine) {
return database.destinationDocker.remoteIpAddress;
}
if ($appSession.ipv6) {
return $appSession.ipv6;
}
if ($appSession.ipv4) {
return $appSession.ipv4;
}
return '<Cannot determine public IP address>';
} else {
return database.id;
function ipAddress() {
if ($status.database.isPublic) {
if (database.destinationDocker.remoteEngine) {
return database.destinationDocker.remoteIpAddress;
}
};
if ($appSession.ipv6) {
return $appSession.ipv6;
}
if ($appSession.ipv4) {
return $appSession.ipv4;
}
return '<Cannot determine public IP address>';
} else {
return database.id;
}
}
function generateUrl() {
const user = () => {
if (databaseDbUser) {
return databaseDbUser + ':';
@ -183,16 +183,38 @@
class:cursor-pointer={!$status.database.isRunning}
/></a
>
<label for="host">{$t('forms.host')}</label>
<CopyPasswordField
placeholder={$t('forms.generated_automatically_after_start')}
isPasswordField={false}
readonly
disabled
id="host"
name="host"
value={database.id}
/>
{#if $status.database.isPublic}
<label for="internalHost">Internal Host</label>
<CopyPasswordField
isPasswordField={false}
readonly
disabled
id="internalHost"
name="internalHost"
value={database.id}
/>
<label for="host">Public Host</label>
<CopyPasswordField
placeholder={$t('forms.generated_automatically_after_start')}
isPasswordField={false}
readonly
disabled
id="host"
name="host"
value={loading.public ? 'Loading...' : ipAddress()}
/>
{:else}
<label for="internalHost">Host</label>
<CopyPasswordField
isPasswordField={false}
readonly
disabled
id="internalHost"
name="internalHost"
value={database.id}
/>
{/if}
<label for="publicPort">{$t('forms.port')}</label>
<CopyPasswordField
placeholder={$t('database.generated_automatically_after_set_to_public')}

View File

@ -1,7 +1,7 @@
{
"name": "coolify",
"description": "An open-source & self-hostable Heroku / Netlify alternative.",
"version": "3.12.26",
"version": "3.12.27",
"license": "Apache-2.0",
"repository": "github:coollabsio/coolify",
"scripts": {