moved router, gateways to a single config file opensrf_core.xml
authorerickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Mon, 22 Aug 2005 15:19:11 +0000 (15:19 +0000)
committererickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Mon, 22 Aug 2005 15:19:11 +0000 (15:19 +0000)
remvoed router_config.xml and gateway.xml config files
make config.sh only ask for prefix, other directories are assumed (and can obviously be changed in install.conf if necessary)

git-svn-id: svn://svn.open-ils.org/ILS/trunk@1686 dcc99617-32d9-48b4-a31d-7c20da2025e4

16 files changed:
Open-ILS/examples/openils.xml.example
Open-ILS/src/Makefile
OpenSRF/bin/opensrf_all
OpenSRF/examples/opensrf_core.xml.example [new file with mode: 0644]
OpenSRF/src/Makefile
OpenSRF/src/gateway/Makefile
OpenSRF/src/gateway/gateway.xml.example [deleted file]
OpenSRF/src/gateway/mod_ils_gateway.c
OpenSRF/src/libstack/osrf_app_session.c
OpenSRF/src/libstack/osrf_system.c
OpenSRF/src/libstack/osrf_system.h
OpenSRF/src/router/Makefile
OpenSRF/src/router/router.c
OpenSRF/src/router/router_config.xml.example [deleted file]
OpenSRF/src/srfsh/srfsh.c
config.sh

index 1882e3e..69a51cc 100644 (file)
@@ -12,20 +12,20 @@ For non-core config info, see the inline documentation within this file
        <default>
        
                <dirs>
-                       <log>/path/to/log</log>
-                       <sock>/path/to/sock</sock>
-                       <pid>/path/to/pid</pid>
+                       <log>/openils/var/log</log>
+                       <sock>/openils/var/sock</sock>
+                       <pid>/openils/var/pid</pid>
 
                        <!-- xsl stylesheets go here -->
-                       <xsl>/path/to/xsl</xsl>
-                       <conf>/path/to/conf</conf>
+                       <xsl>/openils/var/xsl</xsl>
+                       <conf>/openils/var/conf</conf>
                </dirs>
 
                <server_type>prefork</server_type>
 
                <!-- script for exception strings -->
-               <ex_script>/path/to/templates/strings/ex.ttk</ex_script>
-               <perm_script>/path/to/templates/strings/perm.ttk</perm_script>
+               <ex_script>/openils/var/templates/strings/ex.ttk</ex_script>
+               <perm_script>/openils/var/templates/strings/perm.ttk</perm_script>
 
                <z3950>
 
@@ -82,7 +82,7 @@ For non-core config info, see the inline documentation within this file
                                </unix_config>
 
                                <app_settings>
-                                       <dbfile>/path/to/dbfile/persist.db</dbfile>
+                                       <dbfile>/openils/var/db/persist.db</dbfile>
                                </app_settings>
 
                        </opensrf.persist>
@@ -242,13 +242,13 @@ For non-core config info, see the inline documentation within this file
 
                                <app_settings>
                                        <rules>
-                                               <main>/path/to/circ/circ_main.rules</main>
-                                               <permission>/path/to/circ/permit_circ.rules</permission>
-                                               <duration>/path/to/circ/calculate_duration.rules</duration>
-                                               <recurring_fines>/path/to/circ/calculate_recurring_fines.rules</recurring_fines>
-                                               <max_fines>/path/to/circ/calculate_max_fines.rules</max_fines>
-                                               <permit_hold>/path/to/circ/permit_hold.rules</permit_hold>
-                                               <permit_renew>/path/to/circ/permit_renew.rules</permit_renew>
+                                               <main>/openils/var/circ/circ_main.rules</main>
+                                               <permission>/openils/var/circ/permit_circ.rules</permission>
+                                               <duration>/openils/var/circ/calculate_duration.rules</duration>
+                                               <recurring_fines>/openils/var/circ/calculate_recurring_fines.rules</recurring_fines>
+                                               <max_fines>/openils/var/circ/calculate_max_fines.rules</max_fines>
+                                               <permit_hold>/openils/var/circ/permit_hold.rules</permit_hold>
+                                               <permit_renew>/openils/var/circ/permit_renew.rules</permit_renew>
                                        </rules>
                                </app_settings>
 
index 53bd1bf..f9b16c8 100644 (file)
@@ -23,6 +23,8 @@ mod_xmltools-install:
        make -C apachemods mod_xmltools-install
 
 webcore-install:
+       echo $@
+       echo "Copying web into $(WEBDIR)"
        mkdir -p $(WEBDIR)
        cp -r ../web/* $(WEBDIR)
 
index 510fd0e..9014411 100755 (executable)
@@ -42,7 +42,6 @@ JSERVERLOG="$LOGDIR/jserver.log" # jabber server log
 JSERVERPORT=5222;                                              # jabber server port 
 JSERVERLEVEL=3; # can be 1-4, 4 is the highest
 JSERVERIP="*"; # can be "*" or a specific local IP address
-ROUTERLOG="$LOGDIR/router.log" # jabber router log
 # --------------------------------------------------------------------------
 # --------------------------------------------------------------------------
 
@@ -82,7 +81,7 @@ function startJserver {
 
 
 function startRouter {
-       "$BINDIR/router" "$ETCDIR/router_config.xml" 
+       "$BINDIR/router" "$ETCDIR/opensrf_core.xml" 
 }
 
 function startOpenSRF {
diff --git a/OpenSRF/examples/opensrf_core.xml.example b/OpenSRF/examples/opensrf_core.xml.example
new file mode 100644 (file)
index 0000000..a29f5f1
--- /dev/null
@@ -0,0 +1,89 @@
+<?xml version='1.0'?>
+
+<!-- Bootstrap config file for the C opensrf_stack library -->
+<config>
+
+       <!-- The section between <gateway>...</gateway> is a standard OpenSRF C stack config file -->
+       <gateway>
+
+               <!--  the routers's name on the network -->
+               <router_name>router</router_name>
+
+               <!-- jabber domains to connect to (domain1, domain2, ...) -->
+               <domains>
+                       <domain1>127.0.0.1</domain1>
+               </domains>
+
+               <!-- jabber login info -->
+               <username>mylogin</username>
+               <passwd>mypassword</passwd>
+
+               <!-- If the port is a positive number,
+                       we will connect via TCP port, if not and unixpath is defined,
+                       we will connect via UNIX domain socket with the given path -->
+               <port>5222</port>
+               <unixpath>/openils/var/sock/jserver.sock</unixpath>
+       
+               <!-- log file location -->
+               <logfile>/openils/var/log/gateway.log</logfile>
+               <!-- 0 None, 1 Error, 2 Warning, 3 Info, 4 debug -->
+               <loglevel>3</loglevel>
+
+       </gateway>
+
+       <rest_gateway>
+               <router_name>router</router_name>
+               <domains>
+                       <domain1>127.0.0.1</domain1>
+               </domains>
+               <username>mylogin</username>
+               <passwd>mypassword</passwd>
+               <port>5222</port>
+               <unixpath>/openils/var/sock/jserver.sock</unixpath>
+               <logfile>/openils/var/log/gateway.log</logfile>
+               <loglevel>3</loglevel>
+       </rest_gateway>
+
+
+       <!-- ======================================================================================== -->
+
+       <router>
+               <component>0</component> <!-- leave disabled for now -->
+       
+               <trusted_domains>
+                       <!-- Trusted servers are allowed to register apps with the router -->
+                       <server1>127.0.0.1</server1>
+                       <!-- Trusted clients are allowed to send packets through the router -->
+                       <client1>127.0.0.1</client1>
+               </trusted_domains>
+       
+               <transport>
+                       <!-- jabber server are we connecting to -->
+                       <server>127.0.0.1</server>
+                       <!-- If the port is a positive number,
+                               we will connect via TCP port, if not and unixpath is defined,
+                               we will connect via UNIX domain socket with the given path -->
+                       <port>5222</port>
+                       <unixpath>/openils/var/sock/unix_sock</unixpath>
+
+                       <!-- router's name on the network -->
+                       <username>router</username>
+                       <password>mypassword</password>
+                       <!-- router's jabber resource --> 
+                       <resource>router</resource>
+                       <connect_timeout>10</connect_timeout>
+                       <max_reconnect_attempts>5</max_reconnect_attempts>
+               </transport>
+       
+               <logfile>/openils/var/log/router.log</logfile>
+               <loglevel>3</loglevel>
+       
+       </router>
+
+       <!-- ======================================================================================== -->
+
+</config>
+
+
+
+
index 25c7904..7c65d73 100644 (file)
@@ -108,6 +108,7 @@ perl-install:       install-prep
        cp ../bin/opensrf_ctl $(BINDIR)
        cp ../bin/opensrf_all $(BINDIR)
        cp ../examples/opensrf.xml.example $(ETCDIR)
+       cp ../examples/opensrf_core.xml.example $(ETCDIR)
 
 
 # --------------------------------------------------------------------------------
index dfabd9e..38e898e 100644 (file)
@@ -18,7 +18,6 @@ msg:
        echo "-> $$(pwd)"       
 
 install: 
-       cp gateway.xml.example $(ETCDIR)
        echo installing ils_gateway
        $(APXS2) -i -a -n ils_gateway libmod_ils_gateway.so
        echo installing ils_rest_gateway
diff --git a/OpenSRF/src/gateway/gateway.xml.example b/OpenSRF/src/gateway/gateway.xml.example
deleted file mode 100644 (file)
index ed8cdd2..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-<!-- Bootstrap config file for the C opensrf_stack library -->
-<config>
-       <bootstrap>
-               <!-- log level (WARN, INFO, DEBUG) -->
-               <debug>INFO</debug>
-
-               <!-- best to leave this untouched if possible -->
-               <router_name>router</router_name>
-
-               <!-- jabber domains to connect to (domain1, domain2, ...) -->
-               <domains>
-                       <domain1>host.example.com</domain1>
-               </domains>
-
-               <!-- jabber connection information. Note that unix socket connectes are
-                               not yet implemented with any of the C libraries so port will 
-                               have to be a port number -->
-               <username>my_jabber_login</username>
-               <passwd>my_jabber_password</passwd>
-               <port>5222</port>
-               <unixpath>/path/to/unix_sock_file</unixpath>
-
-       </bootstrap>
-
-       <!-- log file location -->
-       <logs>
-               <client>/path/to/log/gateway.log</client>
-       </logs>
-
-</config>
index e8dd01b..9fafbd2 100644 (file)
 
 
 static void mod_ils_gateway_child_init(apr_pool_t *p, server_rec *s) {
-       if( ! osrf_system_bootstrap_client( "/openils/conf/gateway.xml") ) 
+       char* context = "gateway";
+       #ifdef RESTGATEWAY
+       context = "rest_gateway";
+       #endif
+       if( ! osrf_system_bootstrap_client( "/home/erickson/sandbox/openils/conf/opensrf_core.xml", context) ) 
                fatal_handler("Unable to load gateway config file...");
        fprintf(stderr, "Bootstrapping %d\n", getpid() );
        fflush(stderr);
index f9dee7a..3648e40 100644 (file)
@@ -247,8 +247,8 @@ osrf_app_session* osrf_app_client_session_init( char* remote_service ) {
 
        char target_buf[512];
        memset(target_buf,0,512);
-       char* domain    = config_value( "opensrf.bootstrap", "//bootstrap/domains/domain1" ); /* just the first for now */
-       char* router_name = config_value( "opensrf.bootstrap", "//bootstrap/router_name" );
+       char* domain    = config_value( "opensrf.bootstrap", "//%s/domains/domain1", osrf_config_context ); /* just the first for now */
+       char* router_name = config_value( "opensrf.bootstrap", "//%s/router_name", osrf_config_context );
        sprintf( target_buf, "%s@%s/%s",  router_name, domain, remote_service );
        free(domain);
        free(router_name);
index def7433..8c8ced8 100644 (file)
@@ -6,35 +6,32 @@ transport_client* osrf_system_get_transport_client() {
        return global_client;
 }
 
-int osrf_system_bootstrap_client( char* config_file ) {
+int osrf_system_bootstrap_client( char* config_file, char* contextnode ) {
 
        if( config_file == NULL )
                fatal_handler("No Config File Specified\n" );
 
        config_reader_init( "opensrf.bootstrap", config_file ); 
+       
+       osrf_config_context = contextnode;
 
-       char* log_file          = config_value( "opensrf.bootstrap", "//logs/client" );
-       char* log_level = config_value( "opensrf.bootstrap", "//bootstrap/debug" );
-       char* domain            = config_value( "opensrf.bootstrap", "//bootstrap/domains/domain1" ); /* just the first for now */
-       char* username          = config_value( "opensrf.bootstrap", "//bootstrap/username" );
-       char* password          = config_value( "opensrf.bootstrap", "//bootstrap/passwd" );
-       char* port                      = config_value( "opensrf.bootstrap", "//bootstrap/port" );
-       char* unixpath          = config_value( "opensrf.bootstrap", "//bootstrap/unixpath" );
+       char* log_file          = config_value( "opensrf.bootstrap", "//%s/logfile", contextnode );
+       char* log_level = config_value( "opensrf.bootstrap", "//%s/loglevel", contextnode );
+       char* domain            = config_value( "opensrf.bootstrap", "//%s/domains/domain1", contextnode ); /* just the first for now */
+       char* username          = config_value( "opensrf.bootstrap", "//%s/username", contextnode );
+       char* password          = config_value( "opensrf.bootstrap", "//%s/passwd", contextnode );
+       char* port                      = config_value( "opensrf.bootstrap", "//%s/port", contextnode );
+       char* unixpath          = config_value( "opensrf.bootstrap", "//%s/unixpath", contextnode );
 
        int llevel = 0;
        int iport = 0;
        if(port) iport = atoi(port);
-
-       if                      (!strcmp(log_level, "ERROR"))   llevel = LOG_ERROR;
-       else if (!strcmp(log_level, "WARN"))    llevel = LOG_WARNING;
-       else if (!strcmp(log_level, "INFO"))    llevel = LOG_INFO;
-       else if (!strcmp(log_level, "DEBUG"))   llevel = LOG_DEBUG;
+       if(log_level) llevel = atoi(log_level);
 
        log_init( llevel, log_file );
 
        info_handler("Bootstrapping system with domain %s, port %d, and unixpath %s", domain, iport, unixpath );
 
-       // XXX config values 
        transport_client* client = client_init( domain, iport, unixpath, 0 );
        char buf[256];
        memset(buf,0,256);
index 5f42728..70fe6f3 100644 (file)
@@ -6,10 +6,16 @@
 #ifndef OSRF_SYSTEM_H
 #define OSRF_SYSTEM_H
 
-/** Connects to jabber.  Returns 1 on success, 0 on failure */
-int osrf_system_bootstrap_client(); 
+/** Connects to jabber.  Returns 1 on success, 0 on failure 
+       contextnode is the location in the config file where we collect config info
+*/
+
+char* osrf_config_context;
+
+int osrf_system_bootstrap_client( char* config_file, char* contextnode );
 transport_client* osrf_system_get_transport_client();
 
 int osrf_system_shutdown(); 
 
+
 #endif
index fc7c4ee..cd1e3ec 100644 (file)
@@ -13,7 +13,6 @@ msg:
 install: 
        echo installing router
        cp router $(BINDIR)
-       cp router_config.xml.example $(ETCDIR)
 
 router:  router.c $(LIB_SOURCES)
        echo $@
index f3ddfba..5ca2c19 100644 (file)
@@ -27,7 +27,7 @@ int main( int argc, char* argv[] ) {
        config_reader_init( "opensrf.router", argv[1] );        
        if( conf_reader == NULL ) fatal_handler( "main(): Config is NULL" ); 
 
-       /* laod the config options */
+       /* load the config options */
        char* server                    = config_value("opensrf.router", "//router/transport/server");
        char* port                              = config_value("opensrf.router", "//router/transport/port");
        char* unixpath                  = config_value("opensrf.router", "//router/transport/unixpath");
@@ -38,10 +38,14 @@ int main( int argc, char* argv[] ) {
        char* max_retries               = config_value("opensrf.router", "//router/transport/max_reconnect_attempts" );
        char* component         = config_value("opensrf.router", "//router/component" );
 
+       fprintf(stderr, "Router connecting with uname %s, server %s, port %s, unixpath %s",
+               username, server, port, unixpath );
+
 
        /* set up the logger */
-       char* level = config_value("opensrf.router","//log/level");
-       char* log_file = config_value("opensrf.router","//log/file");
+       char* level = config_value("opensrf.router","//router/loglevel");
+       char* log_file = config_value("opensrf.router","//router/logfile");
+
        int llevel = atoi(level);
        fprintf(stderr, "Level %d; file %s\n", llevel, log_file );
 
diff --git a/OpenSRF/src/router/router_config.xml.example b/OpenSRF/src/router/router_config.xml.example
deleted file mode 100644 (file)
index 1020ddd..0000000
+++ /dev/null
@@ -1,52 +0,0 @@
-<router>
-
-       <component>0</component> <!-- leave disabled for now -->
-
-       <trusted_domains>
-
-               <!-- 
-                       Trusted servers are allowed to register apps with the router 
-               -->
-               <server1>server1.domain.com</server1>
-               <server2>server2.domain.com</server2>
-
-               <!--
-                       Trusted clients are allowed to send queries to the router
-               -->
-               <client1>client1.domain.com</client1>
-               <client2>client2.domain.com</client2>
-
-       </trusted_domains>
-
-
-       <!-- jabber connection information. Note that unix socket connectes are
-                       not yet implemented with any of the C libraries so port will 
-                       have to be a port number -->
-
-       <transport>
-               <server>jabber_server.domain.com</server>
-               <port>5222</port>
-               <unixpath>/path/to/unix_sock</unixpath>
-               <username>router</username>
-               <password>my_password</password>
-               <resource>router</resource>
-               <connect_timeout>10</connect_timeout>
-               <max_reconnect_attempts>5</max_reconnect_attempts>
-       </transport>
-
-
-       <log>
-               <file>/pines/log/router.log</file>
-
-               <!--    
-                       0 No logging
-                       1 Error logging
-                       2 Warning
-                       3 Info 
-                       4 debug
-               -->
-               <level>3</level>
-       </log>
-
-
-</router>
index 8672c2d..d1cdf01 100644 (file)
@@ -17,7 +17,7 @@ int main( int argc, char* argv[] ) {
        sprintf(fbuf,"%s/.srfsh.xml",home);
 
        if(!access(fbuf, R_OK)) {
-               if( ! osrf_system_bootstrap_client(fbuf) ) 
+               if( ! osrf_system_bootstrap_client(fbuf, "srfsh") ) 
                        fatal_handler( "Unable to bootstrap client for requests");
 
        } else {
index 87d4cc0..4e5b6b4 100755 (executable)
--- a/config.sh
+++ b/config.sh
@@ -37,9 +37,6 @@ function buildConfig {
        echo "Type Enter to select the default"
        echo "-----------------------------------------------------------------------";
 
-       prompt "Temporary files directory [$TMP] "
-       read X; if [ ! -z "$X" ]; then TMP="$X"; fi;
-
        prompt "Install prefix [$PREFIX] ";
        read X; if [ ! -z "$X" ]; then PREFIX="$X"; fi
 
@@ -53,27 +50,7 @@ function buildConfig {
        TEMPLATEDIR="$PREFIX/var/templates";
        CIRCRULESDIR="$PREFIX/var/circ";
        XSLDIR="$PREFIX/var/xsl";
-
-       prompt "Executables directory [$BINDIR] "
-       read X; if [ ! -z "$X" ]; then BINDIR="$X"; fi;
-
-       prompt "Lib directory [$LIBDIR] "
-       read X; if [ ! -z "$X" ]; then LIBDIR="$X"; fi;
-
-       prompt "Perl directory [$PERLDIR] "
-       read X; if [ ! -z "$X" ]; then PERLDIR="$X"; fi;
-
-       prompt "Include files directory [$INCLUDEDIR] "
-       read X; if [ ! -z "$X" ]; then INCLUDEDIR="$X"; fi;
-
-       prompt "Config files directory [$ETCDIR] "
-       read X; if [ ! -z "$X" ]; then ETCDIR="$X"; fi;
-
-       prompt "Web Root Directory [$WEBDIR] "
-       read X; if [ ! -z "$X" ]; then WEBDIR="$X"; fi;
-
-       prompt "Web CGI Directory [$CGIDIR] "
-       read X; if [ ! -z "$X" ]; then CGIDIR="$X"; fi;
+       TMP="$(pwd)/.tmp";
 
        prompt "Web domain for OPAC in Staff Client [$NEW_OPAC_URL] "
        read X; if [ ! -z "$X" ]; then NEW_OPAC_URL="$X"; fi;
@@ -84,15 +61,6 @@ function buildConfig {
        prompt "Package Label for Staff Client [$NEW_XUL_PACKAGE_LABEL] "
        read X; if [ ! -z "$X" ]; then NEW_XUL_PACKAGE_LABEL="$X"; fi;
 
-       prompt "Templates directory [$TEMPLATEDIR] "
-       read X; if [ ! -z "$X" ]; then TEMPLATEDIR="$X"; fi;
-
-       prompt "XSL Stylesheets directory [$XSLDIR] "
-       read X; if [ ! -z "$X" ]; then XSLDIR="$X"; fi;
-
-       prompt "Custom circulation rules directory [$CIRCRULESDIR] "
-       read X; if [ ! -z "$X" ]; then CIRCRULESDIR="$X"; fi;
-
        prompt "Apache2 apxs binary [$APXS2] "
        read X; if [ ! -z "$X" ]; then APXS2="$X"; fi;
 
@@ -211,6 +179,8 @@ function writeConfig {
 
        prompt "To write a new config, run 'make config'";
        prompt "";
+       prompt "To edit individual install locations (e.g. changing the lib directory),"
+       prompt "edit the install.conf file generated from this script"
 
 }