Fix proxy headers and help sync boot
This commit is contained in:
@@ -53,6 +53,23 @@ refresh_config_cache() {
|
||||
php artisan view:clear >/dev/null 2>&1 || true
|
||||
}
|
||||
|
||||
ensure_help_cache() {
|
||||
cd "$APP_TARGET"
|
||||
|
||||
if [[ "${HELP_SYNC_ON_BOOT:-auto}" == "0" ]]; then
|
||||
return
|
||||
fi
|
||||
|
||||
if [[ "${HELP_SYNC_ON_BOOT:-auto}" == "1" ]]; then
|
||||
php artisan help:sync >/dev/null 2>&1 || true
|
||||
return
|
||||
fi
|
||||
|
||||
if ! compgen -G "$APP_TARGET/storage/app/help/*/*/articles.json" > /dev/null; then
|
||||
php artisan help:sync >/dev/null 2>&1 || true
|
||||
fi
|
||||
}
|
||||
|
||||
wait_for_service() {
|
||||
local name="$1" host="$2" port="$3" timeout="$4"
|
||||
local start
|
||||
@@ -120,6 +137,7 @@ ensure_helper_scripts
|
||||
prepare_storage
|
||||
refresh_config_cache
|
||||
wait_for_dependencies
|
||||
ensure_help_cache
|
||||
|
||||
cd "$APP_TARGET"
|
||||
exec "$@"
|
||||
|
||||
@@ -20,6 +20,10 @@ server {
|
||||
fastcgi_pass app:9000;
|
||||
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
||||
fastcgi_param PATH_INFO $fastcgi_path_info;
|
||||
fastcgi_param HTTP_X_FORWARDED_PROTO $http_x_forwarded_proto;
|
||||
fastcgi_param HTTP_X_FORWARDED_HOST $http_x_forwarded_host;
|
||||
fastcgi_param HTTP_X_FORWARDED_FOR $proxy_add_x_forwarded_for;
|
||||
fastcgi_param HTTPS $http_x_forwarded_proto;
|
||||
fastcgi_buffer_size 32k;
|
||||
fastcgi_buffers 8 16k;
|
||||
}
|
||||
|
||||
24
tests/Feature/Help/HelpSyncServiceTest.php
Normal file
24
tests/Feature/Help/HelpSyncServiceTest.php
Normal file
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature\Help;
|
||||
|
||||
use App\Services\Help\HelpSyncService;
|
||||
use Illuminate\Support\Facades\Config;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Tests\TestCase;
|
||||
|
||||
class HelpSyncServiceTest extends TestCase
|
||||
{
|
||||
public function test_help_sync_writes_compiled_articles(): void
|
||||
{
|
||||
Storage::fake('local');
|
||||
Config::set('help.disk', 'local');
|
||||
|
||||
$service = $this->app->make(HelpSyncService::class);
|
||||
$result = $service->sync();
|
||||
|
||||
$this->assertNotEmpty($result);
|
||||
Storage::disk('local')->assertExists('help/guest/en/articles.json');
|
||||
Storage::disk('local')->assertExists('help/guest/de/articles.json');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user