1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-02-15 05:57:23 +03:00

feature #1370: select session storage in configuration

This commit is contained in:
Javi Fontan 2013-03-05 11:51:09 +01:00
parent 55b3d1a9ad
commit a4a6f566ca
2 changed files with 27 additions and 1 deletions

View File

@ -31,6 +31,16 @@
:host: 127.0.0.1
:port: 9869
# Place where to store sessions, this value can be memory or memcache
# Use memcache when starting multiple server processes, for example,
# with passenger
:sessions: memory
# Memcache configuration
:memcache_host: localhost
:memcache_port: 11211
:memcache_namespace: opennebula.sunstone
################################################################################
# Log
################################################################################

View File

@ -80,7 +80,23 @@ set :config, conf
set :bind, settings.config[:host]
set :port, settings.config[:port]
use Rack::Session::Pool, :key => 'sunstone'
case settings.config[:sessions]
when 'memory'
use Rack::Session::Pool, :key => 'sunstone'
when 'memcache'
memcache_server=settings.config[:memcache_host]+':'<<
settings.config[:memcache_port].to_s
STDERR.puts memcache_server
use Rack::Session::Memcache,
:memcache_server => memcache_server,
:namespace => settings.config[:memcache_namespace]
else
STDERR.puts "Wrong value for :sessions in configuration file"
exit(-1)
end
# Enable logger