Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Spartacus CCv2 Build process for multiple enviroments

We're currently setting up a Spartacus application running on CCv2 with three different enviroments (dev, stage, prod).

We are struggling to set the right OCC API Urls, within Spartacus, for the enviroment, I guess the way to go are enviroment variables, as this is Angular standard, but we couldn't find a way to match the enviroment vars to the corresponding system.

Is there something we're missing?

Thanks for your help!

like image 201
Adrian Fella Avatar asked Feb 27 '20 14:02

Adrian Fella


1 Answers

The OCC baseUrl can actually be provided by CCv2 automatically. This is described in the docs.

It works like this:

  1. Add a static meta tag in your index.html, with placeholder content <meta name="occ-backend-base-url" content="OCC_BACKEND_BASE_URL_VALUE" />
  2. The placeholder will get replaced automatically by CCv2
  3. Remove the static configured baseUrl in the Spartacus configuration, as this will take precedence over the meta tag (we're about to change this)

This is however the only configuration that is environment specific, the ticket referenced by Grin is indeed a feature that we like to add.

like image 135
tobi-or-not-tobi Avatar answered Jan 03 '23 01:01

tobi-or-not-tobi