Merge branch 'next' into feature/ai-templates

This commit is contained in:
Andras Bacsai
2024-10-04 12:44:15 +02:00
committed by GitHub
5 changed files with 40 additions and 68 deletions

View File

@@ -48,14 +48,6 @@ class Add extends Component
public function submit()
{
$this->validate();
// if (str($this->value)->startsWith('{{') && str($this->value)->endsWith('}}')) {
// $type = str($this->value)->after('{{')->before('.')->value;
// if (! collect(SHARED_VARIABLE_TYPES)->contains($type)) {
// $this->dispatch('error', 'Invalid shared variable type.', 'Valid types are: team, project, environment.');
// return;
// }
// }
$this->dispatch('saveKey', [
'key' => $this->key,
'value' => $this->value,

View File

@@ -53,30 +53,16 @@ class All extends Component
public function sortEnvironmentVariables()
{
if ($this->resource->type() === 'application') {
$this->resource->load(['environment_variables', 'environment_variables_preview']);
} else {
$this->resource->load(['environment_variables']);
if (! data_get($this->resource, 'settings.is_env_sorting_enabled')) {
if ($this->resource->environment_variables) {
$this->resource->environment_variables = $this->resource->environment_variables->sortBy('order')->values();
}
if ($this->resource->environment_variables_preview) {
$this->resource->environment_variables_preview = $this->resource->environment_variables_preview->sortBy('order')->values();
}
}
$sortBy = data_get($this->resource, 'settings.is_env_sorting_enabled') ? 'key' : 'order';
$sortFunction = function ($variables) use ($sortBy) {
if (! $variables) {
return $variables;
}
if ($sortBy === 'key') {
return $variables->sortBy(function ($item) {
return strtolower($item->key);
}, SORT_NATURAL | SORT_FLAG_CASE)->values();
} else {
return $variables->sortBy('order')->values();
}
};
$this->resource->environment_variables = $sortFunction($this->resource->environment_variables);
$this->resource->environment_variables_preview = $sortFunction($this->resource->environment_variables_preview);
$this->getDevView();
}
@@ -121,6 +107,8 @@ class All extends Component
$this->sortEnvironmentVariables();
} catch (\Throwable $e) {
return handleError($e, $this);
} finally {
$this->refreshEnvs();
}
}

View File

@@ -1076,12 +1076,12 @@ class Service extends BaseModel
public function environment_variables(): HasMany
{
return $this->hasMany(EnvironmentVariable::class)->orderByRaw("key LIKE 'SERVICE%' DESC, value ASC");
return $this->hasMany(EnvironmentVariable::class)->orderByRaw("LOWER(key) LIKE LOWER('SERVICE%') DESC, LOWER(key) ASC");
}
public function environment_variables_preview(): HasMany
{
return $this->hasMany(EnvironmentVariable::class)->where('is_preview', true)->orderBy('key', 'asc');
return $this->hasMany(EnvironmentVariable::class)->where('is_preview', true)->orderByRaw("LOWER(key) LIKE LOWER('SERVICE%') DESC, LOWER(key) ASC");
}
public function workdir()

View File

@@ -56,13 +56,13 @@
@else
<form wire:submit.prevent='submit' class="flex flex-col gap-2">
<x-forms.textarea rows="10" class="whitespace-pre-wrap" id="variables" wire:model="variables" label="Production Environment Variables"></x-forms.textarea>
@if ($showPreview)
<x-forms.textarea rows="10" class="whitespace-pre-wrap" label="Preview Deployments Environment Variables"
id="variablesPreview" wire:model="variablesPreview"></x-forms.textarea>
@endif
<x-forms.button type="submit" class="btn btn-primary">Save All Environment Variables</x-forms.button>
</form>
@endif
</div>
</div>

View File

@@ -2,28 +2,29 @@
# documentation: https://invoiceninja.github.io/selfhost.html
# slogan: The leading open-source invoicing platform
# tags: invoicing, billing, accounting, finance, self-hosted
# port: 9000
services:
invoice-ninja:
image: invoiceninja/invoiceninja:5
environment:
- SERVICE_FQDN_INVOICENINJA
- APP_ENV=production
- APP_ENV=${APP_ENV:-production}
- APP_URL=${SERVICE_FQDN_INVOICENINJA}
- APP_KEY=${SERVICE_BASE64_INVOICENINJA}
- APP_DEBUG=false
- REQUIRE_HTTPS=false
- PHANTOMJS_PDF_GENERATION=false
- PDF_GENERATOR=snappdf
- TRUSTED_PROXIES=*
- QUEUE_CONNECTION=database
- DB_HOST=mysql
- DB_PORT=3306
- DB_DATABASE=${MYSQL_DATABASE:-invoice_ninja}
- DB_USERNAME=${SERVICE_USER_MYSQL}
- DB_PASSWORD=${SERVICE_PASSWORD_MYSQL}
- APP_KEY=${SERVICE_REALBASE64_INVOICENINJA}
- APP_DEBUG=${APP_DEBUG:-false}
- REQUIRE_HTTPS=${REQUIRE_HTTPS:-false}
- PHANTOMJS_PDF_GENERATION=${PHANTOMJS_PDF_GENERATION:-false}
- PDF_GENERATOR=${PDF_GENERATOR:-snappdf}
- TRUSTED_PROXIES=${TRUSTED_PROXIES:-*}
- QUEUE_CONNECTION=${QUEUE_CONNECTION:-database}
- DB_HOST=${DB_HOST:-mariadb}
- DB_PORT=${DB_PORT:-3306}
- DB_DATABASE=${DB_DATABASE:-invoiceninja}
- DB_USERNAME=$SERVICE_USER_INVOICENINJA
- DB_PASSWORD=$SERVICE_PASSWORD_INVOICENINJA
healthcheck:
test: ['CMD', 'curl', '-f', 'http://127.0.0.1:9000']
test: ['CMD', 'echo', 'ok']
interval: 5s
timeout: 20s
retries: 10
@@ -78,28 +79,19 @@ services:
post_max_size = 60M
upload_max_filesize = 50M
depends_on:
mysql:
mariadb:
condition: service_healthy
mysql:
image: mariadb:lts
mariadb:
image: mariadb:11
volumes:
- mariadb-data:/var/lib/mysql
environment:
- MYSQL_USER=${SERVICE_USER_MYSQL}
- MYSQL_PASSWORD=${SERVICE_PASSWORD_MYSQL}
- MYSQL_DATABASE=${MYSQL_DATABASE:-invoice_ninja}
- MYSQL_ROOT_PASSWORD=${SERVICE_PASSWORD_MYSQLROOT}
- MYSQL_ROOT_PASSWORD=$SERVICE_PASSWORD_ROOT
- MYSQL_DATABASE=${DB_DATABASE:-invoiceninja}
- MYSQL_USER=$SERVICE_USER_INVOICENINJA
- MYSQL_PASSWORD=$SERVICE_PASSWORD_INVOICENINJA
healthcheck:
test:
[
"CMD",
"mysqladmin",
"ping",
"-h",
"127.0.0.1",
"-uroot",
"-p${SERVICE_PASSWORD_MYSQLROOT}",
]
test: ["CMD", "healthcheck.sh", "--connect", "--innodb_initialized"]
interval: 5s
timeout: 20s
retries: 10
volumes:
- invoice-ninja-mysql-data:/var/lib/mysql