h2. The REST API URL
In some cases when you develop a recipe, you may need access to the Cloudify management server/s.
h4(impt). In a production environment, we recommend that you use two management servers.
This access may be required for invoking REST API calls either on the management servers or on services via the management servers. In any case, you need the management servers’ REST URL.
h4(info). Cloudify will soon “(newwindow)expose”:https://cloudifysource.atlassian.net/browse/CLOUDIFY-1515?jql=resolution%20%3D%20Unresolved%20AND%20reporter%20%3D%20currentUser%28%29 this IP address, but until then, there are two options:
h3. Use LOOKUPLOCATORS
Retrieve the value of the *@LOOKUPLOCATORS@* environment variable from within a recipe, parse it and then get the address from it.
The LOOKUPLOCATORS environment variable contains the IP address and port of the LUS (Lookup Service), so you need to take the IP address and instead of the LUS port, use 8100 which is the default REST API port in Cloudify.
In case you have two management servers, the structure of the LOOKUPLOCATORS environment variable is *@IP_ADDRESS1:port1;IP_ADDRESS2:port2@* and after parsing it, you can use any of the two IP addresses.
h3. Wrap the CLI with a script
I’ve created a short script that retrieves the REST IP addresses and ports and then stores it in the Cloudify service context attributes store.
Here it is :