Giter VIP home page Giter VIP logo

Comments (4)

bendvc avatar bendvc commented on August 27, 2024

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.

johnboxall avatar johnboxall commented on August 27, 2024

Today, you can also override the proxy configs using environments variables:

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.

nx-renezwinge avatar nx-renezwinge commented on August 27, 2024

@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 avatar bendvc commented on August 27, 2024

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.