From 29df6161ef24e29984d5379640faad24d0e73161 Mon Sep 17 00:00:00 2001 From: Tomas Cohen Arazi Date: Tue, 6 Sep 2016 16:45:36 -0300 Subject: [PATCH] Bug 17262: Inject MEMCACHED_* variables into Plack's env MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit This patch adds two functions to koha-functions.sh to read the MEMCACHED_* variables from configured instances' apache files (the only source for that info for now). It then tweaks koha-plack's start_plack() function so it exports the variables to env before launching starman. The patch seems trivial, but it highlights a bigger problem with our Plack integration as the starman server seems to hang if those environment variables are defined! Sponsored-by: ByWater Solutions Signed-off-by: Frédéric Demians --- debian/scripts/koha-functions.sh | 26 ++++++++++++++++++++++++++ debian/scripts/koha-plack | 2 ++ 2 files changed, 28 insertions(+) diff --git a/debian/scripts/koha-functions.sh b/debian/scripts/koha-functions.sh index cf6835d8ad..b6f12035d9 100755 --- a/debian/scripts/koha-functions.sh +++ b/debian/scripts/koha-functions.sh @@ -43,6 +43,32 @@ get_apache_config_for() fi } +get_memcached_servers_for() +{ + local instance=$1 + + local apache_file=$(get_apache_config_for $instance) + local memcached_servers=$( + grep 'MEMCACHED_SERVERS' ${apache_file} | + awk '{print $3}' | uniq + ) + + echo "${memcached_servers}" +} + +get_memcached_namespace_for() +{ + local instance=$1 + + local apache_file=$(get_apache_config_for $instance) + local memcached_namespace=$( + grep 'MEMCACHED_NAMESPACE' ${apache_file} | + awk '{print $3}' | uniq + ) + + echo "${memcached_namespace}" +} + get_opacdomain_for() { local site=$1 diff --git a/debian/scripts/koha-plack b/debian/scripts/koha-plack index ed0f42103d..229f0596f6 100755 --- a/debian/scripts/koha-plack +++ b/debian/scripts/koha-plack @@ -84,6 +84,8 @@ start_plack() if ! is_plack_running ${instancename}; then export KOHA_CONF="/etc/koha/sites/${instancename}/koha-conf.xml" + export MEMCACHED_SERVERS=$(get_memcached_servers_for $instancename) + export MEMCACHED_NAMESPACE=$(get_memcached_namespace_for $instancename) log_daemon_msg "Starting Plack daemon for ${instancename}" -- 2.39.5