Comments (4)
Hi René,
We have actually just merged a feature to the SDK allowing for environment specific configuration files. You can see the PR here. But the gist of it is that we'll resolve which configuration file is used based on your current environment.
If you code is running remotely (on managed runtime) the file used will be determined via the current environments name. So if your code is running on an environment called staging
, then the SDK will first look for a configuration file called config/staging.*
. If there is no configuration file with that name it will look for one with the name default
, and if that isn't found, it will look in the pacakage.json file for the configuration.
Similarly when you are developing locally, each developer can create their own config file called config/local.*
this file by default will not be committed to github (if that is what you use) as it is listed in the .gitignore for newly generated projects. That file can have is where the developer can make changes specific to their environment (e.g. connections to their own ODS). Similarly if there is no local config, we'll fallback to looking at the default or config in the package.json.
We're looking to make a release of this feature really soon, so keep your eye out. I'm also happy to answer any other questions you have.
Additionally configuration files written in javascript, yaml, and json are supported.
Ben
from pwa-kit.
Today, you can also override the proxy configs using environments variables:
- https://developer.salesforce.com/docs/commerce/pwa-kit-managed-runtime/guide/proxying-requests.html#overriding-proxy-configurations-with-environment-variables
pwa-kit/packages/pwa-kit-react-sdk/src/utils/ssr-shared.js
Lines 117 to 133 in 915bf3e
As an example, you could use this by re-writing npm start
to load a .env
file and have it inject SSR_PROXY1=https://my-ods
.
from pwa-kit.
@bendvc & @johnboxall Thank you very much for this info :) Then we use the next days the env variables and waiting for the next version.
Last question, if the new config handling is released, the mobify config part in the package.json can be deleted? Because in the PR i didn't saw the deletion.
from pwa-kit.
@bendvc & @johnboxall Thank you very much for this info :) Then we use the next days the env variables and waiting for the next version. Last question, if the new config handling is released, the mobify config part in the package.json can be deleted? Because in the PR i didn't saw the deletion.
If you aren't generating a new project, only upgrading the SDK in an existing retail react app, you can't just delete it as config/default.js
will not exist. You can however move the content into a newly created default.js file in the config folder and only then safely remove the mobify section. Put you don't have to do that to take advantage of per environment configs, you can simply create a locale.js developer config, or environment level config (like production.js) and it will use those only defaulting back to the mobify section of the package.json if none are found.
I'll look into a follow up for removing the mobify section in newly create retail react apps
from pwa-kit.
Related Issues (20)
- How to fetch and use the Content Asset and Content Slot HOT 2
- [BUG] Doubts and possible issue with translations setup HOT 4
- JavaScript heap out of memory with pwa-kit 2.7.0 HOT 10
- [BUG] Multi-Value Query Params Do not Pass Through `pwa-kit-runtime` SDK HOT 2
- [V3]Categories navigation shows loading spinner when user logs out HOT 4
- In SFRA, if we use react then file extension in pwa-kit is possible or not HOT 4
- In SFRA, if we use react then file extension in pwa-kit is possible or not. HOT 1
- [BUG] Commas in cookie values "break" request processor locally HOT 2
- [BUG] User cannot add products to the cart after registering HOT 4
- [BUG] User stuck on confirmation modal when signing out on checkout HOT 5
- [BUG] res.redirect in getProps creates race condition HOT 7
- [BUG] Invalid wrap value for Stack component in item-price HOT 4
- [FEATURE] Allow generics for better responses by commerce-sdk-react HOT 1
- [BUG] viewCategory viewProduct InvalidClientId error HOT 2
- [BUG] request baskets error HOT 3
- [BUG] checkout Invalid DOM property `inputmode`. HOT 1
- [FEATURE] Error or warn if sensitive key name or values are found in `getProps`
- [BUG] Unable to login when password contains certains characters HOT 4
- [BUG] Unable to add simple products to cart HOT 6
- [FEATURE] Support for `x-forwarded-host` header HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pwa-kit.