Hi friends,
I created a note settings/hostconfiguration/jcr:content to configuration (subscription key, service host) for my site. So, I create a clientlib clientlib-config (/etc/designs/abc/clientlib-config) to config the sub scription key and service host.
Example:
settings/hostconfiguration/jcr:content
apiMSubcriptionKey String value="abcxyz123"
serviceHost String value="http://0.0.123.5:8080/service/api/"
config.js code in the clientlib-config
var apiMSubcriptionKey = "abcxyz123";
var url_host = window.location.protocol + "//" + window.location.host;
var url_service = {
'URL': 'http://0.0.123.5:8080/service/api/',
'URL_UPLOAD_IMAGE': '/bin/uploadavatar',
'SUB' : {
'Ocp-Apim-Subscription-Key': apiMSubcriptionKey,
'Authorization': !!localStorage.getItem("__USER_TOKEN")? "Bearer " + localStorage.getItem("__USER_TOKEN"): ""
}
};
In the config.js, I want to get the content value of the apiMSubcriptionKey and serviceHost from settings/hostconfiguration/jcr:content to replace the hard code in config.js.
How to do that?
Thanks & Best regards,
BienHV
Solved! Go to Solution.
Views
Replies
Total Likes
As long as technical challenge is concerned, you can make a call to this url settings/hostconfiguration/jcr:content in json format and get the node data in response.
On other note, if you are planning to do this in publish/prod you may have to double check. If these are secret keys, you may want to perform these operations in backend (java).
Views
Replies
Total Likes
As long as technical challenge is concerned, you can make a call to this url settings/hostconfiguration/jcr:content in json format and get the node data in response.
On other note, if you are planning to do this in publish/prod you may have to double check. If these are secret keys, you may want to perform these operations in backend (java).
Views
Replies
Total Likes
Thanks you for your help,
Could you help me an example?
Views
Replies
Total Likes
Views
Likes
Replies