incubator-couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Kevin R. Coombes" <kevin.r.coom...@gmail.com>
Subject HTML documentation within a couch application
Date Thu, 27 Sep 2012 17:54:55 GMT
Hi,

I have now built several applications with CouchDB using a similar 
structure.  They use CouchApp to maintain the directory structure, and 
(in addition to the views, etc.) contain an _attachements folder that 
includes:
     index.html (the main web-based user interface to the app)
     myapp.js (the main JavaScript code that is loaded by index.html to 
do the work)
     docs.html (linked to from the main page to provide user documentation)

Part of the audience for the documentation includes statisticians and 
bioinformaticians who I am trying to educate about how to write their 
own programs to access the underlying data from the CouchDB database 
directly (as a web service, not through this web site).  So I include 
sample code that shows how to construct some of the URLs that they 
need.  Not surprisingly (at least to anyone who reads this mailing 
list), these all have the form
     http://MY.HOST.NAME/mydb/_design/whatever/blah

The question I have has to do with MY.HOST.NAME.  Right now, this is 
hard-coded into the docs.html attachment.  I recognize that this is a 
really dumb thing to do, especially  if I replicate this application to 
another host. (I even recognize that in doing so I could also change the 
databse name, but let's ignore that fact for now.)  I'm not sure of the 
best way to handle this, which is why I am posting this message.

QUESTION: What is the best way to get the "MY.HOST.NAME" part inside the 
docs.html file to be generated automatically from the host on which the 
database is being served?

Oh, and just to complicate things, you should assume the actual couch 
server is sitting behind a proxy, and I probably don't want the internal 
host name to percolate out into the public documentation. In that 
situation, I would want docs.html to show the name of the proxy server 
instead.

Thanks in advance for your help,
     Kevin



Mime
View raw message