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.
PHP coolifydatabasesdeploymentdockerdocker-composeinertiajslaravelmariadbmysqlnextjsnodejsphppostgresredisself-hostedself-hostingserverstatic-sitesveltesvelte5
Merge branch 'next' into env-vars
Andras Bacsaie7b050a4daaf
diff --cc bootstrap/helpers/shared.phpindex 99f2b9d8d2,0031ce365a..52b5c8d9d5--- a/bootstrap/helpers/shared.php+++ b/bootstrap/helpers/shared.php@@@ -3334,44 -3561,33 +3555,75 @@@ function newParser(Application|Servicereturn $topLevel;}+function generate_fluentd_configuration() : array {+ return [+ 'driver' => 'fluentd',+ 'options' => [+ 'fluentd-address' => 'tcp://127.0.0.1:24224',+ 'fluentd-async' => 'true',+ 'fluentd-sub-second-precision' => 'true',+ // env vars are used in the LogDrain configurations+ 'env' => 'COOLIFY_APP_NAME,COOLIFY_PROJECT_NAME,COOLIFY_SERVER_IP,COOLIFY_ENVIRONMENT_NAME',+ ]+ ];+}++/**+* This method adds the default environment variables to the resource.+* - COOLIFY_APP_NAME+* - COOLIFY_PROJECT_NAME+* - COOLIFY_SERVER_IP+* - COOLIFY_ENVIRONMENT_NAME+*+* Theses variables are added in place to the $where_to_add array.+*+* @param StandaloneRedis|StandalonePostgresql|StandaloneMongodb|StandaloneMysql|StandaloneMariadb|StandaloneKeydb|StandaloneDragonfly|StandaloneClickhouse|Application $resource+* @param Collection $where_to_add+* @param Collection|null $where_to_check+*+*/+function add_coolify_default_environment_variables(StandaloneRedis|StandalonePostgresql|StandaloneMongodb|StandaloneMysql|StandaloneMariadb|StandaloneKeydb|StandaloneDragonfly|StandaloneClickhouse|Application $resource, Collection &$where_to_add, ?Collection $where_to_check = null) {+ if ($where_to_check != null && $where_to_check->where('key', 'COOLIFY_APP_NAME')->isEmpty()) {+ $where_to_add->push("COOLIFY_APP_NAME={$resource->name}");+ }+ if ($where_to_check != null && $where_to_check->where('key', 'COOLIFY_SERVER_IP')->isEmpty()) {+ $where_to_add->push("COOLIFY_SERVER_IP={$resource->destination->server->ip}");+ }+ if ($where_to_check != null && $where_to_check->where('key', 'COOLIFY_ENVIRONMENT_NAME')->isEmpty()) {+ $where_to_add->push("COOLIFY_ENVIRONMENT_NAME={$resource->environment->name}");+ }+ if ($where_to_check != null && $where_to_check->where('key', 'COOLIFY_PROJECT_NAME')->isEmpty()) {+ $where_to_add->push("COOLIFY_PROJECT_NAME={$resource->project()->name}");+ }+++ function convertComposeEnvironmentToArray($environment)+ {+ $convertedServiceVariables = collect([]);+ foreach ($environment as $variableName => $variableValue) {+ if (is_array($variableValue)) {+ $key = str(collect($variableValue)->keys()->first());+ $value = str(collect($variableValue)->values()->first());+ } elseif (is_string($variableValue)) {+ if (str($variableValue)->contains('=')) {+ $key = str($variableValue)->before('=');+ $value = str($variableValue)->after('=');+ } else {+ if (is_numeric($variableName)) {+ $key = str($variableValue);+ $value = null;+ } else {+ $key = str($variableName);+ if ($variableValue) {+ $value = str($variableValue);+ } else {+ $value = null;+ }+ }+ }+ }+ $convertedServiceVariables->put($key->value(), $value?->value() ?? null);+ }++ return $convertedServiceVariables;++}