How to set oData Endpoint URL after deployment

Hi Radzen Team
I have a project which uses data source that connects to odata service, after deployment it still remembers the URL I use during development, how do I change it ?

Regards
Yapp

Hi Yapp,

You can change the OData endpoint on Radzen deploy screen:

Best Regards,
Vladimir

Hi Radzen Team,

Thank you for the guidance but what if I choose to deploy to a ZIP file and install the application to different IIS server which may have different odata endpoint url.

Do we get a chance to configure the oData endpoint URL in the Client app, like what we can do to the connection string value in the appsettings.json file or by defining an environment variable in the IIS to be read during runtime?

Regards,
Yapp

Hi Yapp,

Do you want to have a runtime configuration for the Angular application? The Angular CLI (which Radzen uses under the hood) only supports build-time configuration. We will figure some way to support runtime configuration though.
Until then there is only one solution which doesn’t involve rebuilding the app - replacing the required value in the main.js file which Radzen produces.

1 Like

Hi Yapp,

We just released a new version of Radzen that should support changing the data source endpoint at runtime. To do so do the following.

  1. Create a file called client\src\assets\config.json with contents {}
  2. Build your Radzen application in production.
  3. Now your app will read config.json and merge it with the values from environment.production.ts.

For example to change the URL of a certain endpoint follow this procedure:

  1. Open environment.production.ts and find your data source e.g. "mydatasource": "http://example.com/odata"
  2. Open assets\config.json and add a new entry for mydatasource with the new URL value:
{
   "mydatasource": "http://somethingelse.com/odata"
}
1 Like