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 jsonwebtoken from 'jsonwebtoken';
import { checkContainer, removeContainer } from './docker'; import { checkContainer, removeContainer } from './docker';
import { day } from './dayjs'; import { day } from './dayjs';
import { saveBuildLog, saveDockerRegistryCredentials } from './buildPacks/common'; import { saveBuildLog } from './buildPacks/common';
import { scheduler } from './scheduler'; import { scheduler } from './scheduler';
import type { ExecaChildProcess } from 'execa'; 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 isDev = process.env.NODE_ENV === 'development';
export const proxyPort = process.env.COOLIFY_PROXY_PORT; export const proxyPort = process.env.COOLIFY_PROXY_PORT;
export const proxySecurePort = process.env.COOLIFY_PROXY_SECURE_PORT; export const proxySecurePort = process.env.COOLIFY_PROXY_SECURE_PORT;

View File

@@ -49,8 +49,7 @@
databaseDbUser = ''; databaseDbUser = '';
} }
} }
function generateUrl() { function ipAddress() {
const ipAddress = () => {
if ($status.database.isPublic) { if ($status.database.isPublic) {
if (database.destinationDocker.remoteEngine) { if (database.destinationDocker.remoteEngine) {
return database.destinationDocker.remoteIpAddress; return database.destinationDocker.remoteIpAddress;
@@ -65,7 +64,8 @@
} else { } else {
return database.id; return database.id;
} }
}; }
function generateUrl() {
const user = () => { const user = () => {
if (databaseDbUser) { if (databaseDbUser) {
return databaseDbUser + ':'; return databaseDbUser + ':';
@@ -183,7 +183,17 @@
class:cursor-pointer={!$status.database.isRunning} class:cursor-pointer={!$status.database.isRunning}
/></a /></a
> >
<label for="host">{$t('forms.host')}</label> {#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 <CopyPasswordField
placeholder={$t('forms.generated_automatically_after_start')} placeholder={$t('forms.generated_automatically_after_start')}
isPasswordField={false} isPasswordField={false}
@@ -191,8 +201,20 @@
disabled disabled
id="host" id="host"
name="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} value={database.id}
/> />
{/if}
<label for="publicPort">{$t('forms.port')}</label> <label for="publicPort">{$t('forms.port')}</label>
<CopyPasswordField <CopyPasswordField
placeholder={$t('database.generated_automatically_after_set_to_public')} placeholder={$t('database.generated_automatically_after_set_to_public')}

View File

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