Skip to content

An open-source, self-hostable PaaS alternative to Vercel, Heroku & Netlify that lets you easily deploy static sites, databases, full-stack applications and 360+ one-click services on your own servers.

add env vars for db services 😢

Vahora245d16e0556
diff --git a/app/Actions/Database/StartClickhouse.php b/app/Actions/Database/StartClickhouse.php
index 4943d926cd..5084185576 100644
--- a/app/Actions/Database/StartClickhouse.php
+++ b/app/Actions/Database/StartClickhouse.php
@@ -168,6 +168,21 @@ class StartClickhouse
$environment_variables->push("CLICKHOUSE_ADMIN_PASSWORD={$this->database->clickhouse_admin_password}");
}
+ // TODO: move this in a shared function
+ if ($environment_variables->where('key', 'COOLIFY_APP_NAME')->isEmpty()) {
+ $environment_variables->push("COOLIFY_APP_NAME={$this->database->name}");
+ }
+ if ($environment_variables->where('key', 'COOLIFY_SERVER_IP')->isEmpty()) {
+ $environment_variables->push("COOLIFY_SERVER_IP={$this->database->destination->server->ip}");
+ }
+ if ($environment_variables->where('key', 'COOLIFY_ENVIRONMENT_NAME')->isEmpty()) {
+ $environment_variables->push("COOLIFY_ENVIRONMENT_NAME={$this->database->environment->name}");
+ }
+ if ($environment_variables->where('key', 'COOLIFY_PROJECT_NAME')->isEmpty()) {
+ $environment_variables->push("COOLIFY_PROJECT_NAME={$this->database->project()->name}");
+ }
+
+
return $environment_variables->all();
}
}
diff --git a/app/Actions/Database/StartKeydb.php b/app/Actions/Database/StartKeydb.php
index b13bc75524..4493bf114e 100644
--- a/app/Actions/Database/StartKeydb.php
+++ b/app/Actions/Database/StartKeydb.php
@@ -171,6 +171,21 @@ class StartKeydb
$environment_variables->push("REDIS_PASSWORD={$this->database->keydb_password}");
}
+ // TODO: move this in a shared function
+ if ($environment_variables->where('key', 'COOLIFY_APP_NAME')->isEmpty()) {
+ $environment_variables->push("COOLIFY_APP_NAME={$this->database->name}");
+ }
+ if ($environment_variables->where('key', 'COOLIFY_SERVER_IP')->isEmpty()) {
+ $environment_variables->push("COOLIFY_SERVER_IP={$this->database->destination->server->ip}");
+ }
+ if ($environment_variables->where('key', 'COOLIFY_ENVIRONMENT_NAME')->isEmpty()) {
+ $environment_variables->push("COOLIFY_ENVIRONMENT_NAME={$this->database->environment->name}");
+ }
+ if ($environment_variables->where('key', 'COOLIFY_PROJECT_NAME')->isEmpty()) {
+ $environment_variables->push("COOLIFY_PROJECT_NAME={$this->database->project()->name}");
+ }
+
+
return $environment_variables->all();
}
diff --git a/app/Actions/Database/StartMariadb.php b/app/Actions/Database/StartMariadb.php
index b2b5f8f003..42b8ad2723 100644
--- a/app/Actions/Database/StartMariadb.php
+++ b/app/Actions/Database/StartMariadb.php
@@ -177,6 +177,21 @@ class StartMariadb
$environment_variables->push("MARIADB_PASSWORD={$this->database->mariadb_password}");
}
+ // TODO: move this in a shared function
+ if ($environment_variables->where('key', 'COOLIFY_APP_NAME')->isEmpty()) {
+ $environment_variables->push("COOLIFY_APP_NAME={$this->database->name}");
+ }
+ if ($environment_variables->where('key', 'COOLIFY_SERVER_IP')->isEmpty()) {
+ $environment_variables->push("COOLIFY_SERVER_IP={$this->database->destination->server->ip}");
+ }
+ if ($environment_variables->where('key', 'COOLIFY_ENVIRONMENT_NAME')->isEmpty()) {
+ $environment_variables->push("COOLIFY_ENVIRONMENT_NAME={$this->database->environment->name}");
+ }
+ if ($environment_variables->where('key', 'COOLIFY_PROJECT_NAME')->isEmpty()) {
+ $environment_variables->push("COOLIFY_PROJECT_NAME={$this->database->project()->name}");
+ }
+
+
return $environment_variables->all();
}
diff --git a/app/Actions/Database/StartMongodb.php b/app/Actions/Database/StartMongodb.php
index 3ec8f0aa56..954b8381a9 100644
--- a/app/Actions/Database/StartMongodb.php
+++ b/app/Actions/Database/StartMongodb.php
@@ -190,6 +190,21 @@ class StartMongodb
$environment_variables->push("MONGO_INITDB_DATABASE={$this->database->mongo_initdb_database}");
}
+ // TODO: move this in a shared function
+ if ($environment_variables->where('key', 'COOLIFY_APP_NAME')->isEmpty()) {
+ $environment_variables->push("COOLIFY_APP_NAME={$this->database->name}");
+ }
+ if ($environment_variables->where('key', 'COOLIFY_SERVER_IP')->isEmpty()) {
+ $environment_variables->push("COOLIFY_SERVER_IP={$this->database->destination->server->ip}");
+ }
+ if ($environment_variables->where('key', 'COOLIFY_ENVIRONMENT_NAME')->isEmpty()) {
+ $environment_variables->push("COOLIFY_ENVIRONMENT_NAME={$this->database->environment->name}");
+ }
+ if ($environment_variables->where('key', 'COOLIFY_PROJECT_NAME')->isEmpty()) {
+ $environment_variables->push("COOLIFY_PROJECT_NAME={$this->database->project()->name}");
+ }
+
+
return $environment_variables->all();
}
diff --git a/app/Actions/Database/StartMysql.php b/app/Actions/Database/StartMysql.php
index 7eba18b6a6..9749eceace 100644
--- a/app/Actions/Database/StartMysql.php
+++ b/app/Actions/Database/StartMysql.php
@@ -177,6 +177,21 @@ class StartMysql
$environment_variables->push("MYSQL_PASSWORD={$this->database->mysql_password}");
}
+ // TODO: move this in a shared function
+ if ($environment_variables->where('key', 'COOLIFY_APP_NAME')->isEmpty()) {
+ $environment_variables->push("COOLIFY_APP_NAME={$this->database->name}");
+ }
+ if ($environment_variables->where('key', 'COOLIFY_SERVER_IP')->isEmpty()) {
+ $environment_variables->push("COOLIFY_SERVER_IP={$this->database->destination->server->ip}");
+ }
+ if ($environment_variables->where('key', 'COOLIFY_ENVIRONMENT_NAME')->isEmpty()) {
+ $environment_variables->push("COOLIFY_ENVIRONMENT_NAME={$this->database->environment->name}");
+ }
+ if ($environment_variables->where('key', 'COOLIFY_PROJECT_NAME')->isEmpty()) {
+ $environment_variables->push("COOLIFY_PROJECT_NAME={$this->database->project()->name}");
+ }
+
+
return $environment_variables->all();
}
diff --git a/app/Actions/Database/StartPostgresql.php b/app/Actions/Database/StartPostgresql.php
index 184cc68978..14a5a29306 100644
--- a/app/Actions/Database/StartPostgresql.php
+++ b/app/Actions/Database/StartPostgresql.php
@@ -199,6 +199,21 @@ class StartPostgresql
$environment_variables->push("POSTGRES_DB={$this->database->postgres_db}");
}
+ // TODO: move this in a shared function
+ if ($environment_variables->where('key', 'COOLIFY_APP_NAME')->isEmpty()) {
+ $environment_variables->push("COOLIFY_APP_NAME={$this->database->name}");
+ }
+ if ($environment_variables->where('key', 'COOLIFY_SERVER_IP')->isEmpty()) {
+ $environment_variables->push("COOLIFY_SERVER_IP={$this->database->destination->server->ip}");
+ }
+ if ($environment_variables->where('key', 'COOLIFY_ENVIRONMENT_NAME')->isEmpty()) {
+ $environment_variables->push("COOLIFY_ENVIRONMENT_NAME={$this->database->environment->name}");
+ }
+ if ($environment_variables->where('key', 'COOLIFY_PROJECT_NAME')->isEmpty()) {
+ $environment_variables->push("COOLIFY_PROJECT_NAME={$this->database->project()->name}");
+ }
+
+
return $environment_variables->all();
}
diff --git a/app/Actions/Database/StartRedis.php b/app/Actions/Database/StartRedis.php
index ee78501ea6..b7b32d3048 100644
--- a/app/Actions/Database/StartRedis.php
+++ b/app/Actions/Database/StartRedis.php
@@ -176,6 +176,21 @@ class StartRedis
$environment_variables->push("REDIS_PASSWORD={$this->database->redis_password}");
}
+ // TODO: move this in a shared function
+ if ($environment_variables->where('key', 'COOLIFY_APP_NAME')->isEmpty()) {
+ $environment_variables->push("COOLIFY_APP_NAME={$this->database->name}");
+ }
+ if ($environment_variables->where('key', 'COOLIFY_SERVER_IP')->isEmpty()) {
+ $environment_variables->push("COOLIFY_SERVER_IP={$this->database->destination->server->ip}");
+ }
+ if ($environment_variables->where('key', 'COOLIFY_ENVIRONMENT_NAME')->isEmpty()) {
+ $environment_variables->push("COOLIFY_ENVIRONMENT_NAME={$this->database->environment->name}");
+ }
+ if ($environment_variables->where('key', 'COOLIFY_PROJECT_NAME')->isEmpty()) {
+ $environment_variables->push("COOLIFY_PROJECT_NAME={$this->database->project()->name}");
+ }
+
+
return $environment_variables->all();
}