fix: respect server fqdn
This commit is contained in:
@@ -22,9 +22,6 @@ class General extends Component
|
||||
public string $git_branch;
|
||||
public string|null $git_commit_sha;
|
||||
public string $build_pack;
|
||||
public string|null $wildcard_domain = null;
|
||||
public string|null $server_wildcard_domain = null;
|
||||
public string|null $global_wildcard_domain = null;
|
||||
|
||||
public bool $is_static;
|
||||
public bool $is_git_submodules_enabled;
|
||||
@@ -91,18 +88,20 @@ class General extends Component
|
||||
$this->application->settings->save();
|
||||
$this->application->save();
|
||||
$this->application->refresh();
|
||||
$this->checkWildCardDomain();
|
||||
$this->emit('success', 'Application settings updated!');
|
||||
}
|
||||
|
||||
protected function checkWildCardDomain()
|
||||
{
|
||||
$coolify_instance_settings = InstanceSettings::get();
|
||||
$this->server_wildcard_domain = data_get($this->application, 'destination.server.settings.wildcard_domain');
|
||||
$this->global_wildcard_domain = data_get($coolify_instance_settings, 'wildcard_domain');
|
||||
$this->wildcard_domain = $this->server_wildcard_domain ?? $this->global_wildcard_domain ?? null;
|
||||
}
|
||||
public function getWildcardDomain() {
|
||||
$server = data_get($this->application, 'destination.server');
|
||||
if ($server) {
|
||||
$fqdn = generateFqdn($server, $this->application->uuid);
|
||||
ray($fqdn);
|
||||
$this->application->fqdn = $fqdn;
|
||||
$this->application->save();
|
||||
$this->emit('success', 'Application settings updated!');
|
||||
}
|
||||
|
||||
}
|
||||
public function mount()
|
||||
{
|
||||
$this->is_static = $this->application->settings->is_static;
|
||||
@@ -112,31 +111,6 @@ class General extends Component
|
||||
$this->is_preview_deployments_enabled = $this->application->settings->is_preview_deployments_enabled;
|
||||
$this->is_auto_deploy_enabled = $this->application->settings->is_auto_deploy_enabled;
|
||||
$this->is_force_https_enabled = $this->application->settings->is_force_https_enabled;
|
||||
$this->checkWildCardDomain();
|
||||
}
|
||||
|
||||
public function generateGlobalRandomDomain()
|
||||
{
|
||||
// Set wildcard domain based on Global wildcard domain
|
||||
$url = Url::fromString($this->global_wildcard_domain);
|
||||
$host = $url->getHost();
|
||||
$path = $url->getPath() === '/' ? '' : $url->getPath();
|
||||
$scheme = $url->getScheme();
|
||||
$this->application->fqdn = $scheme . '://' . $this->application->uuid . '.' . $host . $path;
|
||||
$this->application->save();
|
||||
$this->emit('success', 'Application settings updated!');
|
||||
}
|
||||
|
||||
public function generateServerRandomDomain()
|
||||
{
|
||||
// Set wildcard domain based on Server wildcard domain
|
||||
$url = Url::fromString($this->server_wildcard_domain);
|
||||
$host = $url->getHost();
|
||||
$path = $url->getPath() === '/' ? '' : $url->getPath();
|
||||
$scheme = $url->getScheme();
|
||||
$this->application->fqdn = $scheme . '://' . $this->application->uuid . '.' . $host . $path;
|
||||
$this->application->save();
|
||||
$this->emit('success', 'Application settings updated!');
|
||||
}
|
||||
|
||||
public function submit()
|
||||
|
||||
@@ -11,6 +11,7 @@ use App\Traits\SaveFromRedirect;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
use Illuminate\Support\Facades\Route;
|
||||
use Livewire\Component;
|
||||
use Spatie\Url\Url;
|
||||
|
||||
class GithubPrivateRepository extends Component
|
||||
{
|
||||
@@ -144,8 +145,9 @@ class GithubPrivateRepository extends Component
|
||||
$application->settings->is_static = $this->is_static;
|
||||
$application->settings->save();
|
||||
|
||||
$sslip = sslip($destination->server);
|
||||
$application->fqdn = "http://{$application->uuid}.$sslip";
|
||||
$fqdn = generateFqdn($destination->server, $application->uuid);
|
||||
$application->fqdn = $fqdn;
|
||||
|
||||
$application->name = generate_application_name($this->selected_repository_owner . '/' . $this->selected_repository_repo, $this->selected_branch_name, $application->uuid);
|
||||
$application->save();
|
||||
|
||||
|
||||
@@ -112,8 +112,8 @@ class GithubPrivateRepositoryDeployKey extends Component
|
||||
$application->settings->is_static = $this->is_static;
|
||||
$application->settings->save();
|
||||
|
||||
$sslip = sslip($destination->server);
|
||||
$application->fqdn = "http://{$application->uuid}.$sslip";
|
||||
$fqdn = generateFqdn($destination->server, $application->uuid);
|
||||
$application->fqdn = $fqdn;
|
||||
$application->name = generate_random_name($application->uuid);
|
||||
$application->save();
|
||||
|
||||
|
||||
@@ -156,8 +156,8 @@ class PublicGitRepository extends Component
|
||||
$application->settings->is_static = $this->is_static;
|
||||
$application->settings->save();
|
||||
|
||||
$sslip = sslip($destination->server);
|
||||
$application->fqdn = "http://{$application->uuid}.$sslip";
|
||||
$fqdn = generateFqdn($destination->server, $application->uuid);
|
||||
$application->fqdn = $fqdn;
|
||||
$application->name = generate_application_name($this->git_repository, $this->git_branch, $application->uuid);
|
||||
$application->save();
|
||||
|
||||
|
||||
@@ -60,10 +60,10 @@ CMD ["nginx", "-g", "daemon off;"]
|
||||
'source_type' => GithubApp::class
|
||||
]);
|
||||
|
||||
$sslip = sslip($destination->server);
|
||||
$fqdn = generateFqdn($destination->server, $application->uuid);
|
||||
$application->update([
|
||||
'name' => 'dockerfile-' . $application->uuid,
|
||||
'fqdn' => "http://{$application->uuid}.$sslip"
|
||||
'fqdn' => $fqdn
|
||||
]);
|
||||
|
||||
redirect()->route('project.application.configuration', [
|
||||
|
||||
@@ -350,8 +350,7 @@ class Service extends BaseModel
|
||||
}
|
||||
if ($key->startsWith('SERVICE_FQDN')) {
|
||||
if (is_null(data_get($savedService, 'fqdn'))) {
|
||||
$sslip = sslip($this->server);
|
||||
$fqdn = "http://$containerName.$sslip";
|
||||
$fqdn = generateFqdn($this->server, $containerName);
|
||||
if (substr_count($key->value(), '_') === 2 && $key->contains("=")) {
|
||||
$path = $value->value();
|
||||
if ($generatedServiceFQDNS->count() > 0) {
|
||||
@@ -364,7 +363,7 @@ class Service extends BaseModel
|
||||
} else {
|
||||
$generatedServiceFQDNS->put($key->value(), $fqdn);
|
||||
}
|
||||
$fqdn = "http://$containerName.$sslip$path";
|
||||
$fqdn = "$fqdn$path";
|
||||
}
|
||||
if (!$isDatabase) {
|
||||
$savedService->fqdn = $fqdn;
|
||||
@@ -385,8 +384,7 @@ class Service extends BaseModel
|
||||
$forService = $value->afterLast('_');
|
||||
$generatedValue = null;
|
||||
if ($command->value() === 'FQDN' || $command->value() === 'URL') {
|
||||
$sslip = sslip($this->server);
|
||||
$fqdn = "http://$containerName.$sslip";
|
||||
$fqdn = generateFqdn($this->server, $containerName);
|
||||
if ($foundEnv) {
|
||||
$fqdn = data_get($foundEnv, 'value');
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user