commit:4ebc59f7d9fbd644f2a6a4c5abda2cdd9dcb8476
author:Chip Black
committer:Chip Black
date:Fri Feb 27 00:37:03 2015 -0600
parents:b9aab20d149543fcd4d6a541af32eb4d3c51019c
Add runtime configuration to perl lib
diff --git a/lib/perl/Blerg-Database/Database.xs b/lib/perl/Blerg-Database/Database.xs
line changes: +13/-0
index 536bbe1..97b426c
--- a/lib/perl/Blerg-Database/Database.xs
+++ b/lib/perl/Blerg-Database/Database.xs
@@ -10,6 +10,7 @@
 #include "database/tags.h"
 #include "database/subscription.h"
 #include "database/util.h"
+#include "database/configuration.h"
 #include "common/auth.h"
 
 #include "const-c.inc"
@@ -210,3 +211,15 @@ void auth_get_counter(const char *username)
         } else {
             XSRETURN_UNDEF;
         }
+
+void configuration()
+    INIT:
+        HV *confhash;
+    PPCODE:
+        confhash = newHV();
+        hv_store(confhash, "base_path", 9, newSVpv(blergconf.base_path, 0), 0);
+        hv_store(confhash, "data_path", 9, newSVpv(blergconf.data_path, 0), 0);
+        hv_store(confhash, "hash_tags_path", 14, newSVpv(blergconf.hash_tags_path, 0), 0);
+        hv_store(confhash, "ref_tags_path", 13, newSVpv(blergconf.ref_tags_path, 0), 0);
+
+        XPUSHs(sv_2mortal(newRV_noinc((SV*)confhash)));

diff --git a/lib/perl/Blerg-Database/lib/Blerg/Database.pm b/lib/perl/Blerg-Database/lib/Blerg/Database.pm
line changes: +24/-0
index b75b3f7..e462860
--- a/lib/perl/Blerg-Database/lib/Blerg/Database.pm
+++ b/lib/perl/Blerg-Database/lib/Blerg/Database.pm
@@ -244,6 +244,30 @@ Validates that C<name> is a valid tag name.
 
 Validates that C<name> is a valid username.
 
+=item configuration()
+
+Returns a hashref containing runtime configuration information.  Contains these fields:
+
+=over
+
+=item base_path
+
+The base path to the Blërg database
+
+=item data_path
+
+The path under base_path for account data
+
+=item hash_tags_path
+
+The path under base_path for hashtag data
+
+=item ref_tags_path
+
+The path under base_path for mention data
+
+=back
+
 =back
 
 =head2 AUTHENTICATION