From 1d2cca583770e282016a82506d742793f055956e Mon Sep 17 00:00:00 2001 From: Darko Gjorgjijoski Date: Thu, 9 Apr 2026 00:30:59 +0200 Subject: [PATCH] feat(marketplace): make base_url env-configurable for local testing MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The marketplace client (App\Services\Module\ModuleInstaller) and the updater (App\Services\Update\Updater) both build their Guzzle base URI from config('invoiceshelf.base_url') via the App\Traits\SiteApi::getRemote() helper. The value was hardcoded to 'https://invoiceshelf.com', which made local development against a self-hosted invoiceshelf/website checkout impossible without editing the config file by hand. Wrap it in env('INVOICESHELF_BASE_URL', 'https://invoiceshelf.com') so a .env entry can repoint both the marketplace and the updater at any host — e.g. http://invoiceshelf-website.test, http://localhost:8000, or a staging deployment. The default fallback stays https://invoiceshelf.com so production behavior is unchanged. Document the new variable in .env.example, commented out so it has no effect unless explicitly enabled. The marketplace and updater are tied to the same base URL by design — a local dev instance pointed at a local marketplace probably also wants to test against the local release-API, so they should move together. --- .env.example | 5 +++++ config/invoiceshelf.php | 11 +++++++++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/.env.example b/.env.example index 89e85750..0774d263 100644 --- a/.env.example +++ b/.env.example @@ -21,3 +21,8 @@ TRUSTED_PROXIES="*" # Dompdf: keep false so untrusted HTML in PDF notes cannot trigger outbound requests (SSRF). # Set true only if you fully trust all PDF HTML and need remote images/CSS. DOMPDF_ENABLE_REMOTE=false + +# InvoiceShelf marketplace and updater base URL. +# Defaults to https://invoiceshelf.com. Override to point at a local website +# checkout for development: +# INVOICESHELF_BASE_URL=http://invoiceshelf-website.test diff --git a/config/invoiceshelf.php b/config/invoiceshelf.php index fba7c1d3..60182c62 100644 --- a/config/invoiceshelf.php +++ b/config/invoiceshelf.php @@ -42,9 +42,16 @@ return [ 'min_sqlite_version' => '3.35.0', /* - * Marketplace url. + * Marketplace and updater base URL. + * + * The marketplace client (App\Services\Module\ModuleInstaller) and the + * updater (App\Services\Update\Updater) both build their HTTP client base + * URI from this value via App\Traits\SiteApi::getRemote(). Override via + * INVOICESHELF_BASE_URL in .env to point a self-hosted instance or local + * dev environment at a non-production marketplace (e.g. a local checkout + * of the invoiceshelf/website repo). */ - 'base_url' => 'https://invoiceshelf.com', + 'base_url' => env('INVOICESHELF_BASE_URL', 'https://invoiceshelf.com'), /* * Paths protected from cleanup during updates.