Index: /trunk/DataStoreServer/scripts/dsdbh.pm
===================================================================
--- /trunk/DataStoreServer/scripts/dsdbh.pm	(revision 17381)
+++ /trunk/DataStoreServer/scripts/dsdbh.pm	(revision 17381)
@@ -0,0 +1,20 @@
+# create a database handle based on the configuration given
+# in environment variables
+
+sub getDBHandle {
+    my $dbserver = $ENV{DBSERVER};
+    my $dbuser   = $ENV{DBUSER};
+    my $dbpass   = $ENV{DBPASSWORD};
+    my $dbname   = $ENV{DBNAME};
+
+    die "database enviornment not set up" unless defined($dbserver) and defined($dbuser)
+        and defined($dbpass) and defined($dbname);
+
+    my $dsn = "DBI:mysql:host=$dbserver;database=$dbname";
+
+    my $dbh = DBI->connect($dsn, $dbuser, $dbpass) or die "Cannot connect to server\n";
+
+    return $dbh;
+}
+
+return 1;
Index: /trunk/DataStoreServer/scripts/dsfsindex
===================================================================
--- /trunk/DataStoreServer/scripts/dsfsindex	(revision 17380)
+++ /trunk/DataStoreServer/scripts/dsfsindex	(revision 17381)
@@ -8,17 +8,9 @@
 use warnings;
 
+use dsdbh;
 use DBI;
 
-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 $fileset = pop;
@@ -114,18 +106,2 @@
     print "$line\n";
 }
-
-sub getDBHandle {
-    my $ipprc =  PS::IPP::Config->new(); # IPP Configuration
-    my $siteConfig = $ipprc->{_siteConfig};
-
-    my $dbserver = metadataLookupStr($siteConfig, 'DBSERVER');
-    my $dbname   = metadataLookupStr($siteConfig, 'DBNAME');
-    my $dbuser   = metadataLookupStr($siteConfig, 'DBUSER');
-    my $dbpass   = metadataLookupStr($siteConfig, 'DBPASSWORD');
-    exit ($PS_EXIT_CONFIG_ERROR) unless defined $dbserver and $dbname and $dbuser and $dbpass;
-
-    my $dsn = "DBI:mysql:host=$dbserver;database=$dbname";
-
-    my $dbh = DBI->connect($dsn, $dbuser, $dbpass) or die "Cannot connect to server\n";
-    return $dbh;
-}
Index: /trunk/DataStoreServer/scripts/dsprodindex
===================================================================
--- /trunk/DataStoreServer/scripts/dsprodindex	(revision 17380)
+++ /trunk/DataStoreServer/scripts/dsprodindex	(revision 17381)
@@ -7,16 +7,8 @@
 
 use DBI;
-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
-		       );
+use dsdbh;
 
+my $PS_EXIT_CONFIG_ERROR = 3;
+my $PS_EXIT_DATA_ERROR = 5;
 my $product = shift;
 die("must specify product to list") unless defined $product;
@@ -145,19 +137,2 @@
     print "$line\n";
 }
-
-# TODO: move this to a module
-sub getDBHandle {
-    my $ipprc =  PS::IPP::Config->new(); # IPP Configuration
-    my $siteConfig = $ipprc->{_siteConfig};
-
-    my $dbserver = metadataLookupStr($siteConfig, 'DBSERVER');
-    my $dbname   = metadataLookupStr($siteConfig, 'DBNAME');
-    my $dbuser   = metadataLookupStr($siteConfig, 'DBUSER');
-    my $dbpass   = metadataLookupStr($siteConfig, 'DBPASSWORD');
-    exit ($PS_EXIT_CONFIG_ERROR) unless defined $dbserver and $dbname and $dbuser and $dbpass;
-
-    my $dsn = "DBI:mysql:host=$dbserver;database=$dbname";
-
-    my $dbh = DBI->connect($dsn, $dbuser, $dbpass) or die "Cannot connect to server\n";
-    return $dbh;
-}
Index: /trunk/DataStoreServer/scripts/dsrootindex
===================================================================
--- /trunk/DataStoreServer/scripts/dsrootindex	(revision 17380)
+++ /trunk/DataStoreServer/scripts/dsrootindex	(revision 17381)
@@ -8,17 +8,9 @@
 use warnings;
 
+use dsdbh;
+
 use DBI;
 
-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 $dbh = getDBHandle();
@@ -46,19 +38,2 @@
     print $line;
 }
-
-# todo move to a module
-sub getDBHandle {
-    my $ipprc =  PS::IPP::Config->new(); # IPP Configuration
-    my $siteConfig = $ipprc->{_siteConfig};
-
-    my $dbserver = metadataLookupStr($siteConfig, 'DBSERVER');
-    my $dbname   = metadataLookupStr($siteConfig, 'DBNAME');
-    my $dbuser   = metadataLookupStr($siteConfig, 'DBUSER');
-    my $dbpass   = metadataLookupStr($siteConfig, 'DBPASSWORD');
-    exit ($PS_EXIT_CONFIG_ERROR) unless defined $dbserver and $dbname and $dbuser and $dbpass;
-
-    my $dsn = "DBI:mysql:host=$dbserver;database=$dbname";
-
-    my $dbh = DBI->connect($dsn, $dbuser, $dbpass) or die "Cannot connect to server\n";
-    return $dbh;
-}
Index: /trunk/DataStoreServer/scripts/tabledefs.sql
===================================================================
--- /trunk/DataStoreServer/scripts/tabledefs.sql	(revision 17380)
+++ /trunk/DataStoreServer/scripts/tabledefs.sql	(revision 17381)
@@ -77,5 +77,5 @@
 
 # none of these types have any type specific columns
-INSERT INTO dsFileType (type) VALUES('psrequest');
-INSERT INTO dsFileType (type) VALUES('psresults');
-INSERT INTO dsFileType (type) VALUES('pstamp');
+#INSERT INTO dsFileType (type) VALUES('psrequest');
+#INSERT INTO dsFileType (type) VALUES('psresults');
+#INSERT INTO dsFileType (type) VALUES('pstamp');
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 17380)
+++ /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 17380)
+++ /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 17380)
+++ /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 17380)
+++ /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;
Index: /trunk/DataStoreServer/web/conf/httpd-datastore.conf
===================================================================
--- /trunk/DataStoreServer/web/conf/httpd-datastore.conf	(revision 17380)
+++ /trunk/DataStoreServer/web/conf/httpd-datastore.conf	(revision 17381)
@@ -1,5 +1,6 @@
-
-<Directory "/var/www/html/ds/dsroot">
-#<Directory "/ds/dsroot">
+#
+# Root of the data store (where the directory hierarchy lives
+#
+<Directory "/data/ipp000.0/datastore/dsroot">
 
   DirectoryIndex /ds-cgi/dsindex.cgi
@@ -14,10 +15,5 @@
   XBitHack on
 
-  # attempt to turn caching off (doesn't seem to work)
-  ExpiresActive On
-  # expires 0 seconds after access (doesn't get applied)
-  ExpiresDefault A0
-
-#AddType text/plain .txt
+  AddType text/plain .txt
   AddOutputFilter INCLUDES .txt
 
@@ -28,6 +24,10 @@
 </Directory>
 
-<Directory "/cgi-bin/ds-cgi">
-#<Directory "/ds/cgi">
+
+#
+# Location of the cgi scripts
+#
+
+<Directory "/data/ipp000.0/datastore/ds-cgi">
   Options ExecCGI
 
@@ -37,15 +37,5 @@
 </Directory>
 
-Alias       /ds/     /var/www/html/ds/dsroot/
-ScriptAlias /ds-cgi/ /var/www/cgi-bin/ds-cgi/
+Alias       /ds/     /data/ipp000.0/datastore/dsroot/
+ScriptAlias /ds-cgi/ /data/ipp000.0/datastore/ds-cgi/
 
-
-# these don't do what I want
-#AliasMatch (.*)(/index.txt)(.*) $1/$3
-
-#ScriptAliasMatch ^/.*/index.txt /ds-cgi/dsindex.cgi
-#ScriptAlias /var/www/html/ds/dsroot/pstamprequest/index.txt /ds-cgi/dsindex.cgi
-
-#RedirectMatch /ds/.*/index.txt /ds-cgi/dsindex.cgi
-#RedirectMatch /ds/.*  /ds-cgi/dsindex.cgi
-
