This commit is contained in:
Andras Bacsai 2023-06-16 11:01:27 +02:00
parent 2b8467e6a1
commit 2c3ddfd363
14 changed files with 35 additions and 18 deletions

View File

@ -16,7 +16,7 @@ public function __invoke(bool $force)
try {
ray('Running InstanceAutoUpdateJob');
$localhost_name = 'localhost';
if (config('app.env') === 'local') {
if (isDev()) {
$localhost_name = 'testing-local-docker-container';
}
$this->server = Server::where('name', $localhost_name)->firstOrFail();
@ -48,7 +48,7 @@ public function __invoke(bool $force)
}
private function update()
{
if (config('app.env') === 'local') {
if (isDev()) {
ray('Running update on local docker container');
remote_process([
"sleep 10"

View File

@ -12,7 +12,7 @@ class Kernel extends ConsoleKernel
{
protected function schedule(Schedule $schedule): void
{
if (config('app.env') === 'local') {
if (isDev()) {
$schedule->command('horizon:snapshot')->everyMinute();
// $schedule->job(new InstanceDockerCleanupJob)->everyMinute();
// $schedule->job(new InstanceAutoUpdateJob(true))->everyMinute();

View File

@ -47,7 +47,7 @@ public function register(): void
{
$this->reportable(function (Throwable $e) {
$this->settings = InstanceSettings::get();
if ($this->settings->do_not_track || config('app.env') === 'local') {
if ($this->settings->do_not_track || isDev()) {
return;
}
Integration::captureUnhandledException($e);

View File

@ -50,7 +50,7 @@ class GithubPrivateRepositoryDeployKey extends Component
];
public function mount()
{
if (config('app.env') === 'local') {
if (isDev()) {
$this->repository_url = 'https://github.com/coollabsio/coolify-examples';
}
$this->parameters = getRouteParameters();

View File

@ -39,7 +39,7 @@ class PublicGitRepository extends Component
];
public function mount()
{
if (config('app.env') === 'local') {
if (isDev()) {
$this->repository_url = 'https://github.com/coollabsio/coolify-examples';
$this->port = 3000;
}

View File

@ -14,7 +14,7 @@ class InviteLink extends Component
public string $role = 'member';
public function mount()
{
$this->email = config('app.env') === 'local' ? 'test3@example.com' : '';
$this->email = isDev() ? 'test3@example.com' : '';
}
public function viaEmail()
{

View File

@ -16,7 +16,7 @@ public function checkUpdate()
$latestVersion = get_latest_version_of_coolify();
$currentVersion = config('version');
version_compare($currentVersion, $latestVersion, '<') ? $this->isUpgradeAvailable = true : $this->isUpgradeAvailable = false;
if (config('app.env') === 'local') {
if (isDev()) {
$this->isUpgradeAvailable = true;
}
}

View File

@ -7,7 +7,7 @@
function getProxyConfiguration(Server $server)
{
$proxy_path = config('coolify.proxy_config_path');
if (config('app.env') === 'local') {
if (isDev()) {
$proxy_path = $proxy_path . '/testing-host-1/';
}
$networks = collect($server->standaloneDockers)->map(function ($docker) {
@ -77,7 +77,7 @@ function getProxyConfiguration(Server $server)
],
],
];
if (config('app.env') === 'local') {
if (isDev()) {
$config['services']['traefik']['command'][] = "--log.level=debug";
}
return Yaml::dump($config, 4, 2);

View File

@ -82,7 +82,7 @@ function set_transanctional_email_settings()
]);
}
function base_url()
function base_url(bool $withPort = true)
{
$settings = InstanceSettings::get();
if ($settings->fqdn) {
@ -90,10 +90,27 @@ function base_url()
}
$port = config('app.port');
if ($settings->public_ipv4) {
return "http://{$settings->public_ipv4}:{$port}";
if ($withPort) {
if (isDev()) {
return "http://localhost:{$port}";
}
return "http://{$settings->public_ipv4}:{$port}";
}
if (isDev()) {
return "http://localhost";
}
return "http://{$settings->public_ipv4}";
}
if ($settings->public_ipv6) {
return "http://{$settings->public_ipv6}:{$port}";
if ($withPort) {
return "http://{$settings->public_ipv6}:{$port}";
}
return "http://{$settings->public_ipv6}";
}
return url('/');
}
function isDev()
{
return config('app.env') === 'local';
}

View File

@ -1,3 +1,3 @@
<?php
return '4.0.0-nightly.15';
return '4.0.0-nightly.16';

View File

@ -48,7 +48,7 @@ class="relative -ml-24 text-xs text-white normal-case rounded min-w-max menu bg-
@endif
@if (data_get($application, 'ports_mappings_array'))
@foreach ($application->ports_mappings_array as $port)
@if (config('app.env') === 'local')
@if (isDev())
<li>
<a class="text-xs text-white rounded-none hover:no-underline hover:bg-coollabs"
target="_blank" href="http://localhost:{{ explode(':', $port)[0] }}">

View File

@ -14,7 +14,7 @@
<button class="text-white btn-link">{{ data_get($docker, 'network') }} </button>
</a>
@empty
<div class="text-sm">No destinations added</div>
<div class="text-sm">N\A</div>
@endforelse
</div>
<div class="grid gap-2 pt-2">

View File

@ -4,7 +4,7 @@
<div class="flex gap-2">
<h2>General</h2>
<x-forms.button type="submit">Save</x-forms.button>
@if ($server->id !== 0 || config('app.env') === 'local')
@if ($server->id !== 0 || isDev())
<x-forms.button x-on:click.prevent="deleteServer = true">
Delete
</x-forms.button>

View File

@ -12,7 +12,7 @@ class="relative text-xs text-white normal-case rounded -ml-28 min-w-max menu bg-
<li>
<a target="_blank"
class="text-xs text-white rounded-none hover:no-underline hover:bg-coollabs"
href="http://{{ request()->getHost() }}:8080">
href="{{ base_url(withPort: false) }}:8080">
Traefik Dashboard
<x-external-link />
</a>