]> granicus.if.org Git - icinga2/commitdiff
Implement IcingaSysconfDir variable.
authorGunnar Beutner <gunnar.beutner@netways.de>
Wed, 27 Nov 2013 08:23:30 +0000 (09:23 +0100)
committerGunnar Beutner <gunnar.beutner@netways.de>
Wed, 27 Nov 2013 08:46:31 +0000 (09:46 +0100)
Refs #5224

config.h.cmake
doc/4.2-global-variables.md
icinga-app/icinga.cpp
lib/base/application.cpp
lib/base/application.h

index 2a4fe035a739c5538eb620c3cbec15508d5baef5..cc80a2e04b6a8e8e352bcc47f53cb2fe89dfb4d2 100644 (file)
@@ -7,6 +7,7 @@
 #cmakedefine HAVE_VFORK
 
 #define ICINGA_PREFIX "${CMAKE_INSTALL_PREFIX}"
+#define ICINGA_SYSCONFDIR "${CMAKE_INSTALL_FULL_SYSCONFDIR}"
 #define ICINGA_LOCALSTATEDIR "${CMAKE_INSTALL_FULL_LOCALSTATEDIR}"
 #define ICINGA_PKGDATADIR "${CMAKE_INSTALL_FULL_DATADIR}/icinga2"
 
index 247db3c15a61e7c0142a8a7d30f43a51fe3cd14e..becc1de5e663975596a13b616e3c224b85f13b55 100644 (file)
@@ -1,10 +1,11 @@
-## <a id="global-variables"> Global Variables
+## <a id="global-variables"></a> Global Variables
 
 Icinga 2 provides a number of special global variables:
 
 Variable                  |Description
 --------------------------|-------------------
 IcingaPrefixDir           |**Read-only.** Contains the installation prefix that was specified with cmake -DCMAKE_INSTALL_PREFIX. Defaults to /usr/local
+IcingaSysconfDir          |**Read-only.** Contains the path of the sysconf directory. Defaults to IcingaPrefixDir + "/etc".
 IcingaLocalStateDir       |**Read-only.** Contains the path of the local state directory. Defaults to IcingaPrefixDir + "/var".
 IcingaPkgDataDir          |**Read-only.** Contains the path of the package data directory. Defaults to IcingaPrefixDir + "/share/icinga2".
 IcingaStatePath           |**Read-write.** Contains the path of the Icinga 2 state file. Defaults to IcingaLocalStateDir + "/lib/icinga2/icinga2.state".
index 1a203521c5ce44e19fa871084384efed3154f322..d10671b70f468798070a87fb5b4839ae52659cfd 100644 (file)
@@ -198,6 +198,7 @@ int main(int argc, char **argv)
        Application::InstallExceptionHandlers();
 
        Application::DeclarePrefixDir(ICINGA_PREFIX);
+       Application::DeclareSysconfDir(ICINGA_SYSCONFDIR);
        Application::DeclareLocalStateDir(ICINGA_LOCALSTATEDIR);
        Application::DeclarePkgDataDir(ICINGA_PKGDATADIR);
 
index f6220be8e7a0d827baf36e3fdb6f887d421a0682..932e9f9b793f26d064811b521a83c1d7d9674382 100644 (file)
@@ -609,6 +609,26 @@ void Application::DeclarePrefixDir(const String& path)
        ScriptVariable::Declare("IcingaPrefixDir", path);
 }
 
+/**
+ * Retrives the path of the sysconf dir.
+ *
+ * @returns The path.
+ */
+String Application::GetSysconfDir(void)
+{
+       return ScriptVariable::Get("IcingaSysconfDir");
+}
+
+/**
+ * Sets the path of the sysconf dir.
+ *
+ * @param path The new path.
+ */
+void Application::DeclareSysconfDir(const String& path)
+{
+       ScriptVariable::Declare("IcingaSysconfDir", path);
+}
+
 /**
  * Retrieves the path for the local state dir.
  *
index 98e7ee1e560a70b23046e31263c0066e83fef078..720f43c703a8e19b7e9fddaa959ea9828cd4722b 100644 (file)
@@ -73,6 +73,9 @@ public:
        static String GetPrefixDir(void);
        static void DeclarePrefixDir(const String& path);
 
+       static String GetSysconfDir(void);
+       static void DeclareSysconfDir(const String& path);
+
        static String GetLocalStateDir(void);
        static void DeclareLocalStateDir(const String& path);