From e8bd6ccdbd2b4cc84f1efd5a0c345cb043b749c4 Mon Sep 17 00:00:00 2001 From: Keith Woodlock Date: Sun, 21 Oct 2012 12:02:23 +0100 Subject: [PATCH] update docs to handle demo and production servers as well as localhost dev. --- api-docs/apiLive.htm | 32 +++++++++++++++++++------------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/api-docs/apiLive.htm b/api-docs/apiLive.htm index c3b0eb748..6bb67ba0c 100644 --- a/api-docs/apiLive.htm +++ b/api-docs/apiLive.htm @@ -50,22 +50,28 @@ function clickAPILink(apiLink) function getBaseURL(docURL) { - var hostName = ""; - if (QueryParameters["hostname"]) hostName = QueryParameters["hostname"]; - else + var localhostUrl = "https://localhost:8443/mifosng-provider/api/v1/"; + var openmfDemoUrl = "/mifosng-provider/api/v1/"; + + var baseUrl = ""; + + if (docURL.substring(0,4).toLowerCase() == "http") { - if (docURL.substring(0,4).toLowerCase() == "http") - { - var l = getLocation(docURL); - hostName = l.hostname; - } - else - { - //assume running locally - hostName = "localhost"; + var l = getLocation(docURL); + + if (l.hostname == "demo.openmf.org") { + baseUrl = openmfDemoUrl; + } else { + baseUrl = "https://" + l.hostname + ":8443/mifosng-provider/api/v1/" } } - return "https://" + hostName + ":8443/mifosng-provider/api/v1/"; + else + { + //assume running locally + baseUrl = localhostUrl; + } + + return baseUrl; }