Hi,
I built a middleware POST plugin that accesses the session data and also makes a request using ‘TykMakeHttpRequest’.
The newRequest I have for the http request looks something like this.
newRequest = {
“Method”: “GET”,
“Body”: “”,
“headers”: {},
“Domain”: “http://www.domain.net”,
“Resource”: “/somendpoint/” + atok,
“FormData”: {}
};
One thing I am trying to do is configure “Domain”: “http://www.domain.net”. That is, use some sort of Environment variable or a config file to get the url instead of hardcoding it since it is going to be different for different environments. As in, url could be http://www.domain.net on non-production environment and http://www.somedomain.com on a production environment.
Is there a way to access some kind of config, whether it is in a file or environment variables, through the middleware JS ?