Index: trunk/DataStoreServer/web/cgi/dodsfits
===================================================================
--- trunk/DataStoreServer/web/cgi/dodsfits	(revision 17381)
+++ trunk/DataStoreServer/web/cgi/dodsfits	(revision 17381)
@@ -0,0 +1,42 @@
+#!/usr/bin/env perl
+
+use strict;
+use CGI ':standard';
+
+my $DS_DIR = $ENV{"DS_ROOT"};
+
+my $uri = $ENV{'REQUEST_URI'};
+
+$uri = $ARGV[0];
+print STDERR "uri is $uri\n";
+
+(my $left, my $param) = split(/\,/, $uri);
+
+print STDERR "left: $left param: $param\n";
+
+if ($left !~ /\.fits$/) {
+	print header( -status => '404 Not Found' );
+	exit;
+}
+
+my @path = split(/\//, $left);
+
+my $fn = @path[$#path];
+my $fpath = $DS_DIR.'/'.$left;
+
+
+
+print header(	-type => 'image/fits',
+				-attachment => $fn,
+				-content_length => -s $fpath,
+			);
+
+
+open F, $DS_DIR.'/'.$left;
+
+binmode(F);
+binmode(STDOUT);
+
+print while (<F>);
+
+close F;
Index: trunk/DataStoreServer/web/cgi/dsfits.cgi
===================================================================
--- trunk/DataStoreServer/web/cgi/dsfits.cgi	(revision 16955)
+++ trunk/DataStoreServer/web/cgi/dsfits.cgi	(revision 17381)
@@ -1,43 +1,3 @@
-#!/usr/bin/env perl
-
-use strict;
-use CGI ':standard';
-
-my $DS_DIR = '/var/www/html/ds/dsroot';
-#my $DS_DIR = '.';
-
-my $uri = $ENV{'REQUEST_URI'};
-
-$uri = $ARGV[0];
-print STDERR "uri is $uri\n";
-
-(my $left, my $param) = split(/\,/, $uri);
-
-print STDERR "left: $left param: $param\n";
-
-if ($left !~ /\.fits$/) {
-	print header( -status => '404 Not Found' );
-	exit;
-}
-
-my @path = split(/\//, $left);
-
-my $fn = @path[$#path];
-my $fpath = $DS_DIR.'/'.$left;
-
-
-
-print header(	-type => 'image/fits',
-				-attachment => $fn,
-				-content_length => -s $fpath,
-			);
-
-
-open F, $DS_DIR.'/'.$left;
-
-binmode(F);
-binmode(STDOUT);
-
-print while (<F>);
-
-close F;
+#!/bin/bash
+. ./dsshellconfig
+./dodsfits $*
Index: trunk/DataStoreServer/web/cgi/dsgetindex
===================================================================
--- trunk/DataStoreServer/web/cgi/dsgetindex	(revision 16955)
+++ trunk/DataStoreServer/web/cgi/dsgetindex	(revision 17381)
@@ -5,7 +5,8 @@
 # The only required argument is the REQUEST_URI.
 # The number of elements in the URI tell us whether we are listing
-# the root, a product, or a fileset.
-#
-# if a second argument -html is provided, the output is in HTML
+# the data store root, a product, or a fileset.
+#
+# if a second argument -html is provided, the output is in HTML format
+# otherwise plain text is used
 #
 # The only thing specific to the ipp used here is the exit codes.
@@ -16,15 +17,7 @@
 use CGI ':standard';
 use IPC::Cmd 0.36 qw( can_run run );
-use PS::IPP::Config qw($PS_EXIT_SUCCESS
-		       $PS_EXIT_UNKNOWN_ERROR
-		       $PS_EXIT_SYS_ERROR
-		       $PS_EXIT_CONFIG_ERROR
-		       $PS_EXIT_PROG_ERROR
-		       $PS_EXIT_DATA_ERROR
-		       $PS_EXIT_TIMEOUT_ERROR
-		       metadataLookupStr
-		       metadataLookupBool
-		       caturi
-		       );
+
+my $PS_EXIT_CONFIG_ERROR = 3;
+my $PS_EXIT_DATA_ERROR = 5;
 
 my $uri = shift;
@@ -34,4 +27,8 @@
     exit ($PS_EXIT_CONFIG_ERROR);
 }
+
+my $DS_ROOT = $ENV{DS_ROOT};
+
+die("DS_ROOT not found in the environment") unless defined($DS_ROOT);
 
 my @path;
@@ -59,5 +56,5 @@
     # there is no file on the url
 
-    print STDERR "html mode\n";
+    # print STDERR "html mode\n";
 
     ($directories, $query_str) = split/\?/, $uri;
@@ -96,4 +93,5 @@
 
 if (@dirs) {
+    # XXX need to output an error page
     warn("unexpected extra directories: @dirs in uri: $uri");
     exit ($PS_EXIT_CONFIG_ERROR);
@@ -167,5 +165,5 @@
 # XXX:
 # quick hacky pretty printer
-# Stolen Eric's mock up
+# Stolen from Eric's Data Store mock up
 #
 
@@ -174,10 +172,8 @@
 
     print header('text/html', '200 OK');
-    print start_html('Datastore');
+    print start_html('Data Store');
 
 	# get free space
-        # XXX: need to configure DS_DIR
-        my $DS_DIR = '/var/www/html/ds/dsroot';
-	my $ref = df($DS_DIR);
+	my $ref = df($DS_ROOT);
 	printf '<p>Free space: %.2fG (%.1f%%)</p>',
 		$ref->{bfree}/(1024*1024),
Index: trunk/DataStoreServer/web/cgi/dsindex.cgi
===================================================================
--- trunk/DataStoreServer/web/cgi/dsindex.cgi	(revision 16955)
+++ trunk/DataStoreServer/web/cgi/dsindex.cgi	(revision 17381)
@@ -1,2 +1,3 @@
-#!/bin/sh
-/export/data0/bills/psconfig/default.linrh64/bin/pstamp_runcommand.sh dsgetindex $REQUEST_URI -html
+#!/bin/bash
+. ./dsshellconfig
+dsgetindex $REQUEST_URI -html
Index: trunk/DataStoreServer/web/cgi/dsshellconfig
===================================================================
--- trunk/DataStoreServer/web/cgi/dsshellconfig	(revision 17381)
+++ trunk/DataStoreServer/web/cgi/dsshellconfig	(revision 17381)
@@ -0,0 +1,15 @@
+# set up some environment needed by the scripts
+export PERL5LIB=INSERT_VALUE_HERE
+
+# IPC::Cmd::can_run routine doesn't find programs in ds-cgi
+# unless . is in the path
+PATH=.:${PATH}
+
+# setting these here allow the data store to run independnt of the ipp configuration
+export DBSERVER=INSERT_VALUE_HERE
+export DBNAME=INSERT_VALUE_HERE
+export DBPASSWORD=INSERT_VALUE_HERE
+export DBUSER=INSERT_VALUE_HERE
+
+export DS_ROOT=INSERT_VALUE_HERE
+
Index: trunk/DataStoreServer/web/cgi/dstxtindex.cgi
===================================================================
--- trunk/DataStoreServer/web/cgi/dstxtindex.cgi	(revision 16955)
+++ trunk/DataStoreServer/web/cgi/dstxtindex.cgi	(revision 17381)
@@ -1,2 +1,3 @@
-#!/bin/sh
-/export/data0/bills/psconfig/default.linrh64/bin/pstamp_runcommand.sh dsgetindex $REQUEST_URI;
+#!/bin/bash
+. ./dsshellconfig
+./dsgetindex $REQUEST_URI;
