How to read values from config.json file in Custom UI

I have made a config.json file inside the static/hello-world directory in forge CustomUI.

{
    "IQP_Server" : "https://9.109.123.240:8443/ignitePlatformURL"
}

Can someone please help me with how can i access the IQP_Server variable inside the App.js file? Thanks in advance.

Hi @AnjaliChaudhary,

In your App.js try importing the config.json file and accessing it from there. Can something like this address your use case?

import configData from './config.json';
...
console.log(`IQP_Server Value: ${configData.IQP_Server}`);

Hope this helps.

Ian

Yes. It worked. Thanks a lot.

1 Like