1
0
Fork 0
mirror of https://github.com/KingDuckZ/kamokan.git synced 2024-12-27 21:35:41 +00:00

Add a redis_db setting to the ini file.

This commit is contained in:
King_DuckZ 2017-04-21 23:26:01 +01:00
parent b03c3198b8
commit 26aa51c3be
3 changed files with 10 additions and 1 deletions

View file

@ -61,6 +61,7 @@ namespace {
parSettings.add_default("redis_port", "6379");
parSettings.add_default("redis_mode", "sock");
parSettings.add_default("redis_sock", "/tmp/redis.sock");
parSettings.add_default("redis_db", "0");
parSettings.add_default("base_uri", "http://127.0.0.1");
parSettings.add_default("website_root", "html");
}

View file

@ -22,6 +22,7 @@
#include "duckhandy/stringize.h"
#include "pathname/pathname.hpp"
#include "list_highlight_langs.hpp"
#include "duckhandy/lexical_cast.hpp"
#include <utility>
#include <cassert>
#include <fstream>
@ -102,6 +103,7 @@ namespace tawashi {
m_resp_value(std::move(parValue)),
m_base_uri(parSettings["base_uri"]),
//m_page_basename(fetch_page_basename(m_cgi_env)),
m_redis_db(parSettings["redis_db"]),
m_website_root(make_root_path(parSettings)),
m_page_basename(std::move(parPageBaseName)),
m_resp_type(parRespType),
@ -132,8 +134,13 @@ namespace tawashi {
{"languages", make_mstch_langmap()}
};
if (m_redis)
if (m_redis) {
m_redis->wait_for_connect();
auto batch = m_redis->make_batch();
batch.select(dhandy::lexical_cast<int>(m_redis_db));
batch.client_setname("tawashi_v" STRINGIZE(VERSION_MAJOR) "." STRINGIZE(VERSION_MINOR) "." STRINGIZE(VERSION_PATCH));
batch.throw_if_failed();
}
this->on_process();
this->on_mustache_prepare(mustache_context);

View file

@ -59,6 +59,7 @@ namespace tawashi {
cgi::Env m_cgi_env;
std::string m_resp_value;
boost::string_ref m_base_uri;
boost::string_ref m_redis_db;
std::string m_website_root;
std::string m_page_basename;
Types m_resp_type;