feat(marketplace): make base_url env-configurable for local testing

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.
This commit is contained in:
Darko Gjorgjijoski
2026-04-09 00:30:59 +02:00
parent 93b04a0c2a
commit 1d2cca5837
2 changed files with 14 additions and 2 deletions

View File

@@ -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

View File

@@ -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.