Skip to content

refactor: externalize hardcoded URLs to environment configuration#795

Open
vcnainala wants to merge 6 commits into
developmentfrom
refactor/external-urls-from-env
Open

refactor: externalize hardcoded URLs to environment configuration#795
vcnainala wants to merge 6 commits into
developmentfrom
refactor/external-urls-from-env

Conversation

@vcnainala

@vcnainala vcnainala commented Jun 1, 2026

Copy link
Copy Markdown
Member

Summary

  • Centralizes deployment and third-party API URLs in Laravel config (config/app.php, config/filesystems.php, config/services.php) backed by .env variables documented in .env.example and .env.ci.
  • Adds public_storage_url() and public_downloads_url() helpers for S3/Ceph public object and release download links.
  • Replaces hardcoded hosts in jobs, commands, Socialite NFDI provider, DOI metadata, Filament resources, Blade views, and CSP policy with config(), url(), and the new helpers.

Commits

  1. refactor(config) — env keys, filesystems S3/download URLs, services integrations
  2. feat(helper)public_storage_url / public_downloads_url
  3. refactor(app) — PubChem, NPClassifier, OIDC, OLS, GlobalNames, avatars, DOI URLs, Filament
  4. refactor(csp) — configurable CSP origins
  5. refactor(views) — Blade templates and structure editor cheminf depict

Configuration

New/updated env vars (see .env.example): AWS_URL, AWS_ENDPOINT, AWS_BUCKET, AWS_USE_PATH_STYLE_ENDPOINT, AWS_DOWNLOADS_URL, COCONUT_PUBLIC_URL, CM_PUBLIC_API, API_URL, citation APIs, PUBCHEM_API_BASE, NP_CLASSIFIER_URL, NFDI_OIDC_BASE_URL, GLOBALNAMES_API_URL, OLS4_API_BASE, UI_AVATARS_URL.

APP_URL config default is now http://localhost for local development.

Test plan

  • php artisan config:clear succeeds
  • php artisan test (28 passed, 4 skipped)
  • Verify download page links resolve with production/staging .env
  • Verify collection images and structure editor depict load
  • Verify NFDI OIDC login on staging
  • Confirm CSP allows S3, cheminf, and app hosts in browser devtools

Resolves

Closes #780

vcnainala added 5 commits June 1, 2026 19:24
Move S3 public and download bases to filesystems disk config with AWS_*
defaults. Extend services.php for cheminf, citation, regapp OIDC, pubchem,
npclassifier, taxonomy APIs, avatars, and coconut public URL. Document keys in
.env.example and .env.ci. Set APP_URL default to http://localhost for local dev.
Expose filesystems.disks.s3.url and downloads_url via public_storage_url()
and public_downloads_url() for consistent object-storage links in Blade and PHP.
Use services.* config for PubChem, NPClassifier, NFDI OIDC, OLS, GlobalNames,
and ui-avatars. Use url() for collection DOI landing pages. Use public_storage_url
in Filament collection image state.
Build CSP allowlists from app.url, services.coconut.public_url, S3 endpoints,
cheminf, and citation services instead of hardcoded production hostnames.
Use url(), public_storage_url(), public_downloads_url(), and config-driven
cheminf depict base in structure editor, download pages, and navigation.
CI caches config from .env.ci where NFDI_REDIRECT_URL is unset, causing
Policy::add() to receive null and return 500 on email verification routes.
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 76.71233% with 17 lines in your changes missing coverage. Please review.
✅ Project coverage is 6.38%. Comparing base (4223a58) to head (a2da45b).

Files with missing lines Patch % Lines
app/Jobs/ImportPubChem.php 0.00% 3 Missing ⚠️
app/Jobs/ImportPubChemAuto.php 0.00% 3 Missing ⚠️
app/Support/Csp/Policies/CoconutPolicy.php 94.91% 3 Missing ⚠️
.../Filament/Dashboard/Resources/OrganismResource.php 0.00% 2 Missing ⚠️
...ilament/Dashboard/Resources/CollectionResource.php 0.00% 1 Missing ⚠️
app/Filament/Dashboard/Widgets/TopContributors.php 0.00% 1 Missing ⚠️
app/Jobs/ClassifyMoleculeAuto.php 0.00% 1 Missing ⚠️
app/Models/HasDOI.php 0.00% 1 Missing ⚠️
app/Models/Molecule.php 0.00% 1 Missing ⚠️
app/Services/DOI/DataCite.php 0.00% 1 Missing ⚠️
Additional details and impacted files
@@               Coverage Diff                @@
##             development    #795      +/-   ##
================================================
+ Coverage           6.13%   6.38%   +0.24%     
- Complexity          1737    1744       +7     
================================================
  Files                227     227              
  Lines               8961    8992      +31     
================================================
+ Hits                 550     574      +24     
- Misses              8411    8418       +7     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants