diff options
| author | Dan Goodliffe <dan@randomdan.homeip.net> | 2016-06-26 17:39:34 +0100 | 
|---|---|---|
| committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2016-06-26 17:39:34 +0100 | 
| commit | 77a0bae42f6c23bc323f59b79e5fac066680b8aa (patch) | |
| tree | 61d672cb102045f31ea1e27287ba1df61059456f | |
| parent | Add missing status token to HTTP response (diff) | |
| download | icespider-77a0bae42f6c23bc323f59b79e5fac066680b8aa.tar.bz2 icespider-77a0bae42f6c23bc323f59b79e5fac066680b8aa.tar.xz icespider-77a0bae42f6c23bc323f59b79e5fac066680b8aa.zip | |
Load a default config file it one is present
| -rw-r--r-- | icespider/core/Jamfile.jam | 2 | ||||
| -rw-r--r-- | icespider/core/core.cpp | 6 | ||||
| -rw-r--r-- | icespider/core/core.h | 3 | 
3 files changed, 11 insertions, 0 deletions
| diff --git a/icespider/core/Jamfile.jam b/icespider/core/Jamfile.jam index 5dbaf31..13ecc3d 100644 --- a/icespider/core/Jamfile.jam +++ b/icespider/core/Jamfile.jam @@ -1,6 +1,7 @@  lib adhocutil : : : : <include>/usr/include/adhocutil ;  lib slicer : : : : <include>/usr/include/slicer ;  lib boost_system ; +lib boost_filesystem ;  lib icespider-core :  	[ glob-tree *.cpp : bin ] @@ -9,6 +10,7 @@ lib icespider-core :  	<library>adhocutil  	<library>slicer  	<library>boost_system +	<library>boost_filesystem  	<implicit-dependency>../common  	: :  	<include>. diff --git a/icespider/core/core.cpp b/icespider/core/core.cpp index 42aa7c7..3ada79c 100644 --- a/icespider/core/core.cpp +++ b/icespider/core/core.cpp @@ -1,7 +1,10 @@  #include "core.h"  #include <Ice/Initialize.h> +#include <boost/filesystem/convenience.hpp>  namespace IceSpider { +	const boost::filesystem::path Core::defaultConfig("config/ice.properties"); +  	Core::Core(int argc, char ** argv)  	{  		// Big enough to map all the request methods (an empty of zero lenght routes as default) @@ -18,6 +21,9 @@ namespace IceSpider {  		Ice::InitializationData id;  		id.properties = Ice::createProperties(argc, argv); +		if (boost::filesystem::exists(defaultConfig)) { +			id.properties->load(defaultConfig.string()); +		}  		communicator = Ice::initialize(id);  	} diff --git a/icespider/core/core.h b/icespider/core/core.h index a6c42f6..238f4ae 100644 --- a/icespider/core/core.h +++ b/icespider/core/core.h @@ -5,6 +5,7 @@  #include <vector>  #include "irouteHandler.h"  #include <Ice/Communicator.h> +#include <boost/filesystem/path.hpp>  namespace IceSpider {  	class DLL_PUBLIC Core { @@ -23,6 +24,8 @@ namespace IceSpider {  			MethodRoutes routes;  			Ice::CommunicatorPtr communicator; + +			static const boost::filesystem::path defaultConfig;  	};  } | 
