Skip to content

feat: add mediaApiPrefix env var and backend.media.prefix config#21096

Merged
uroslates merged 9 commits intodevelopfrom
feature/CXSPA-12006-media-prefix
Feb 19, 2026
Merged

feat: add mediaApiPrefix env var and backend.media.prefix config#21096
uroslates merged 9 commits intodevelopfrom
feature/CXSPA-12006-media-prefix

Conversation

@uroslates
Copy link
Copy Markdown
Contributor

@uroslates uroslates commented Jan 30, 2026

Closes: https://jira.tools.sap/browse/CXSPA-12005

Adding

  • new Spartacus backend.media.prefix (hidden behind enableMediaPrefix feature flag) - similar to backend.occ.prefix. The new config is used when constructing the media baseUrl (added to the configured host as suffix === uri).
  • new Spartacus environment(-prod).ts file via mediaBaseUrl and mediaApiPrefix used for configuring backend.media.baseUrl and backend.media.prefix respectively.

@uroslates uroslates requested a review from a team as a code owner January 30, 2026 08:18
@github-actions github-actions Bot marked this pull request as draft January 30, 2026 08:18
@uroslates uroslates marked this pull request as ready for review January 30, 2026 17:38
@cypress
Copy link
Copy Markdown

cypress Bot commented Jan 30, 2026

spartacus    Run #51909

Run Properties:  status check passed Passed #51909  •  git commit 20ad15bb1a ℹ️: Merge d6d457866f488422f7513244dd77faead09c9853 into 8dfced6da022d9c299d742c8dc15...
Project spartacus
Branch Review feature/CXSPA-12006-media-prefix
Run status status check passed Passed #51909
Run duration 03m 45s
Commit git commit 20ad15bb1a ℹ️: Merge d6d457866f488422f7513244dd77faead09c9853 into 8dfced6da022d9c299d742c8dc15...
Committer Uros Lates
View all properties for this run ↗︎

Test results
Tests that failed  Failures 0
Tests that were flaky  Flaky 3
Tests that did not run due to a developer annotating a test with .skip  Pending 0
Tests that did not run due to a failure in a mocha hook  Skipped 0
Tests that passed  Passing 101
View all changes introduced in this branch ↗︎

@StanislavSukhanov StanislavSukhanov self-requested a review February 3, 2026 10:04
Copy link
Copy Markdown
Contributor

@StanislavSukhanov StanislavSukhanov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @uroslates great job! Left some comments/suggestions

Comment thread projects/storefrontapp/src/environments/environment.ts Outdated
Comment thread projects/storefrontlib/shared/components/media/media.service.ts Outdated
Comment thread projects/storefrontlib/shared/components/media/media.service.ts
Comment thread projects/core/src/occ/config/default-occ-config.ts Outdated
@github-actions github-actions Bot marked this pull request as draft February 3, 2026 11:38
@uroslates uroslates marked this pull request as ready for review February 3, 2026 11:38
Comment thread projects/storefrontapp/src/environments/environment.ts Outdated
@github-actions github-actions Bot marked this pull request as draft February 3, 2026 14:46
@uroslates uroslates marked this pull request as ready for review February 3, 2026 14:49
@github-actions github-actions Bot marked this pull request as draft February 3, 2026 15:24
@uroslates uroslates marked this pull request as ready for review February 3, 2026 15:25
Copy link
Copy Markdown
Contributor

@StanislavSukhanov StanislavSukhanov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Legit.

@github-actions github-actions Bot marked this pull request as draft February 19, 2026 07:15
@uroslates uroslates marked this pull request as ready for review February 19, 2026 07:18
@github-actions github-actions Bot marked this pull request as draft February 19, 2026 12:30
@uroslates uroslates marked this pull request as ready for review February 19, 2026 12:51
@github-actions github-actions Bot marked this pull request as draft February 19, 2026 13:14
@uroslates uroslates marked this pull request as ready for review February 19, 2026 13:17
@uroslates uroslates merged commit f156650 into develop Feb 19, 2026
38 checks passed
@uroslates uroslates deleted the feature/CXSPA-12006-media-prefix branch February 19, 2026 13:53
Platonn added a commit that referenced this pull request Mar 11, 2026
…ntralize common configs of b2b and b2c in one file; rename b2b and b2c files from '.module.ts' to '.providers.ts'" (#21181)

This reverts commit 70bc432.

**What:**

We're moving the OCC backend (and Media backend) configuration in `storefrontapp` from `app.module.ts` to `spartacus-configuration.module.ts` - to mimic better the fresh apps which have this config in their `spartacus-configuration.module.ts`.
And we extracting repeated config from `spartacus-b2b-...` and `spartacus-b2c-configuration.module.ts` to one `spartacus-configuration.module.ts` and moving the differing parts to renamed b2b and b2c `... .providers.ts` files.

**Why:**

In https://jira.tools.sap/browse/CXSPA-11890 we've modernized storefrontapp to look more like a fresh app - i.e. we moved around configs between app.module, spartacus-storefront.module, spartacus-b2b-storefront.module, spartacus-b2c-storefront.module

But it turned our it broke our `ec-automate-pipelines` scripts, which caused deployment scripts to fail. So we quickly reverted those modernizations of storefrontapp in https://jira.tools.sap/browse/CXSPA-12046 (#21120) , to unblock the testing of the Feb2026 release, with the help of necessary deployment scripts

But now, after we're done with Feb2026 release, we'd like to bring back the modernization of the storefrontapp, and then we'll adjust the `ec-automate-pipelines` script.

**Conflicts resolved with recent changes in develop**
While applying a revert I resolved 2 conflicts with changes that were added in the meantime on `develop`:
- `backend.media` config has been added to `app.module.ts` in #21096 -> so I've moved it to `private.providers.ts` (near backend.occ` config
- `pwa.enable` config has been disabled in github.com//issues/21116 -> so I also keep it disabled

---

**Notes for adjusting `ec-automate-pipelines`:** (generated with Opus 4.5 and human-edited)

OLD Expectations of ec-automate-pipelines:

1. OCC BaseUrl Configuration
- **File:** `projects/storefrontapp/src/app/app.module.ts`
- **Line pattern:** `baseUrl: environment.occBaseUrl`

2. B2B Configuration
- **File:** `spartacus-b2b-configuration.module.ts` (NgModule with `@NgModule({ providers: [...] })`)
- **Structure:** Has `providers: [` array inside NgModule decorator
- **PWA config:** Located IN this file

3. B2C Configuration  
- **File:** `spartacus-b2c-configuration.module.ts` (NgModule)
- **PWA config:** Located IN this file

4. PWA Configuration Location
- **B2B:** In `spartacus-b2b-configuration.module.ts`
- **B2C:** In `spartacus-b2c-configuration.module.ts`
- PWA config enabled

NEW Expectations of ec-automate-pipelines should be:

1. OCC BaseUrl Configuration ⚠️ MOVED
- **New File:** `projects/storefrontapp/src/app/private/private.providers.ts`
- **Old File:** ~~`app.module.ts`~~ (no longer contains OCC config)
- **Line pattern:** Same - `baseUrl: environment.occBaseUrl`

2. B2B Configuration ⚠️ RENAMED & RESTRUCTURED
- **New File:** `spartacus-b2b-configuration.providers.ts`
- **Old File:** ~~`spartacus-b2b-configuration.module.ts`~~ (deleted)
- **Structure:** Uses `makeEnvironmentProviders([...])` instead of NgModule
- **PWA config:** NOT in this file anymore

3. B2C Configuration ⚠️ RENAMED & RESTRUCTURED
- **New File:** `spartacus-b2c-configuration.providers.ts` (standalone providers function)
- **Old File:** ~~`spartacus-b2c-configuration.module.ts`~~ (deleted)
- **PWA config:** NOT in this file anymore

4. PWA Configuration Location ⚠️ CENTRALIZED
- **New Location:** `spartacus-configuration.module.ts` (single location)
- **Old Location:** ~~B2B and B2C modules separately~~ (removed)
- PWA config IS ALREADY DISABLED (no need to disable it with ec-automate-pipelines)!

fixes https://jira.tools.sap/browse/CXSPA-12047
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