Skip to content

Commit f1eb438

Browse files
authored
Merge branch 'next' into feature/ai-templates
2 parents 59c54b8 + be9041d commit f1eb438

File tree

5 files changed

+39
-67
lines changed

5 files changed

+39
-67
lines changed

app/Livewire/Project/Shared/EnvironmentVariable/Add.php

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -48,14 +48,6 @@ public function mount()
4848
public function submit()
4949
{
5050
$this->validate();
51-
// if (str($this->value)->startsWith('{{') && str($this->value)->endsWith('}}')) {
52-
// $type = str($this->value)->after('{{')->before('.')->value;
53-
// if (! collect(SHARED_VARIABLE_TYPES)->contains($type)) {
54-
// $this->dispatch('error', 'Invalid shared variable type.', 'Valid types are: team, project, environment.');
55-
56-
// return;
57-
// }
58-
// }
5951
$this->dispatch('saveKey', [
6052
'key' => $this->key,
6153
'value' => $this->value,

app/Livewire/Project/Shared/EnvironmentVariable/All.php

Lines changed: 9 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -53,29 +53,15 @@ public function instantSave()
5353

5454
public function sortEnvironmentVariables()
5555
{
56-
if ($this->resource->type() === 'application') {
57-
$this->resource->load(['environment_variables', 'environment_variables_preview']);
58-
} else {
59-
$this->resource->load(['environment_variables']);
60-
}
61-
62-
$sortBy = data_get($this->resource, 'settings.is_env_sorting_enabled') ? 'key' : 'order';
63-
64-
$sortFunction = function ($variables) use ($sortBy) {
65-
if (! $variables) {
66-
return $variables;
56+
if (! data_get($this->resource, 'settings.is_env_sorting_enabled')) {
57+
if ($this->resource->environment_variables) {
58+
$this->resource->environment_variables = $this->resource->environment_variables->sortBy('order')->values();
6759
}
68-
if ($sortBy === 'key') {
69-
return $variables->sortBy(function ($item) {
70-
return strtolower($item->key);
71-
}, SORT_NATURAL | SORT_FLAG_CASE)->values();
72-
} else {
73-
return $variables->sortBy('order')->values();
74-
}
75-
};
7660

77-
$this->resource->environment_variables = $sortFunction($this->resource->environment_variables);
78-
$this->resource->environment_variables_preview = $sortFunction($this->resource->environment_variables_preview);
61+
if ($this->resource->environment_variables_preview) {
62+
$this->resource->environment_variables_preview = $this->resource->environment_variables_preview->sortBy('order')->values();
63+
}
64+
}
7965

8066
$this->getDevView();
8167
}
@@ -121,6 +107,8 @@ public function submit($data = null)
121107
$this->sortEnvironmentVariables();
122108
} catch (\Throwable $e) {
123109
return handleError($e, $this);
110+
} finally {
111+
$this->refreshEnvs();
124112
}
125113
}
126114

app/Models/Service.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1076,12 +1076,12 @@ public function scheduled_tasks(): HasMany
10761076
public function environment_variables(): HasMany
10771077
{
10781078

1079-
return $this->hasMany(EnvironmentVariable::class)->orderByRaw("key LIKE 'SERVICE%' DESC, value ASC");
1079+
return $this->hasMany(EnvironmentVariable::class)->orderByRaw("LOWER(key) LIKE LOWER('SERVICE%') DESC, LOWER(key) ASC");
10801080
}
10811081

10821082
public function environment_variables_preview(): HasMany
10831083
{
1084-
return $this->hasMany(EnvironmentVariable::class)->where('is_preview', true)->orderBy('key', 'asc');
1084+
return $this->hasMany(EnvironmentVariable::class)->where('is_preview', true)->orderByRaw("LOWER(key) LIKE LOWER('SERVICE%') DESC, LOWER(key) ASC");
10851085
}
10861086

10871087
public function workdir()

resources/views/livewire/project/shared/environment-variable/all.blade.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,13 +56,13 @@
5656
@else
5757
<form wire:submit.prevent='submit' class="flex flex-col gap-2">
5858
<x-forms.textarea rows="10" class="whitespace-pre-wrap" id="variables" wire:model="variables" label="Production Environment Variables"></x-forms.textarea>
59-
59+
6060
@if ($showPreview)
6161
<x-forms.textarea rows="10" class="whitespace-pre-wrap" label="Preview Deployments Environment Variables"
6262
id="variablesPreview" wire:model="variablesPreview"></x-forms.textarea>
6363
@endif
64-
64+
6565
<x-forms.button type="submit" class="btn btn-primary">Save All Environment Variables</x-forms.button>
6666
</form>
6767
@endif
68-
</div>
68+
</div>

templates/compose/invoice-ninja.yaml

Lines changed: 25 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -2,28 +2,29 @@
22
# documentation: https://invoiceninja.github.io/selfhost.html
33
# slogan: The leading open-source invoicing platform
44
# tags: invoicing, billing, accounting, finance, self-hosted
5+
# port: 9000
56

67
services:
78
invoice-ninja:
89
image: invoiceninja/invoiceninja:5
910
environment:
1011
- SERVICE_FQDN_INVOICENINJA
11-
- APP_ENV=production
12+
- APP_ENV=${APP_ENV:-production}
1213
- APP_URL=${SERVICE_FQDN_INVOICENINJA}
13-
- APP_KEY=${SERVICE_BASE64_INVOICENINJA}
14-
- APP_DEBUG=false
15-
- REQUIRE_HTTPS=false
16-
- PHANTOMJS_PDF_GENERATION=false
17-
- PDF_GENERATOR=snappdf
18-
- TRUSTED_PROXIES=*
19-
- QUEUE_CONNECTION=database
20-
- DB_HOST=mysql
21-
- DB_PORT=3306
22-
- DB_DATABASE=${MYSQL_DATABASE:-invoice_ninja}
23-
- DB_USERNAME=${SERVICE_USER_MYSQL}
24-
- DB_PASSWORD=${SERVICE_PASSWORD_MYSQL}
14+
- APP_KEY=${SERVICE_REALBASE64_INVOICENINJA}
15+
- APP_DEBUG=${APP_DEBUG:-false}
16+
- REQUIRE_HTTPS=${REQUIRE_HTTPS:-false}
17+
- PHANTOMJS_PDF_GENERATION=${PHANTOMJS_PDF_GENERATION:-false}
18+
- PDF_GENERATOR=${PDF_GENERATOR:-snappdf}
19+
- TRUSTED_PROXIES=${TRUSTED_PROXIES:-*}
20+
- QUEUE_CONNECTION=${QUEUE_CONNECTION:-database}
21+
- DB_HOST=${DB_HOST:-mariadb}
22+
- DB_PORT=${DB_PORT:-3306}
23+
- DB_DATABASE=${DB_DATABASE:-invoiceninja}
24+
- DB_USERNAME=$SERVICE_USER_INVOICENINJA
25+
- DB_PASSWORD=$SERVICE_PASSWORD_INVOICENINJA
2526
healthcheck:
26-
test: ['CMD', 'curl', '-f', 'http://127.0.0.1:9000']
27+
test: ['CMD', 'echo', 'ok']
2728
interval: 5s
2829
timeout: 20s
2930
retries: 10
@@ -78,28 +79,19 @@ services:
7879
post_max_size = 60M
7980
upload_max_filesize = 50M
8081
depends_on:
81-
mysql:
82+
mariadb:
8283
condition: service_healthy
83-
mysql:
84-
image: mariadb:lts
84+
mariadb:
85+
image: mariadb:11
86+
volumes:
87+
- mariadb-data:/var/lib/mysql
8588
environment:
86-
- MYSQL_USER=${SERVICE_USER_MYSQL}
87-
- MYSQL_PASSWORD=${SERVICE_PASSWORD_MYSQL}
88-
- MYSQL_DATABASE=${MYSQL_DATABASE:-invoice_ninja}
89-
- MYSQL_ROOT_PASSWORD=${SERVICE_PASSWORD_MYSQLROOT}
89+
- MYSQL_ROOT_PASSWORD=$SERVICE_PASSWORD_ROOT
90+
- MYSQL_DATABASE=${DB_DATABASE:-invoiceninja}
91+
- MYSQL_USER=$SERVICE_USER_INVOICENINJA
92+
- MYSQL_PASSWORD=$SERVICE_PASSWORD_INVOICENINJA
9093
healthcheck:
91-
test:
92-
[
93-
"CMD",
94-
"mysqladmin",
95-
"ping",
96-
"-h",
97-
"127.0.0.1",
98-
"-uroot",
99-
"-p${SERVICE_PASSWORD_MYSQLROOT}",
100-
]
94+
test: ["CMD", "healthcheck.sh", "--connect", "--innodb_initialized"]
10195
interval: 5s
10296
timeout: 20s
10397
retries: 10
104-
volumes:
105-
- invoice-ninja-mysql-data:/var/lib/mysql

0 commit comments

Comments
 (0)