Class: Wafris::Configuration
- Inherits:
-
Object
- Object
- Wafris::Configuration
- Defined in:
- lib/wafris/configuration.rb
Instance Attribute Summary collapse
-
#maxmemory ⇒ Object
Returns the value of attribute maxmemory.
-
#quiet_mode ⇒ Object
Returns the value of attribute quiet_mode.
-
#redis ⇒ Object
Returns the value of attribute redis.
-
#redis_pool_size ⇒ Object
Returns the value of attribute redis_pool_size.
Instance Method Summary collapse
- #connection_pool ⇒ Object
- #core_sha ⇒ Object
- #create_settings ⇒ Object
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
- #wafris_core ⇒ Object
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
12 13 14 15 16 |
# File 'lib/wafris/configuration.rb', line 12 def initialize @redis_pool_size = 20 @maxmemory = 25 @quiet_mode = false end |
Instance Attribute Details
#maxmemory ⇒ Object
Returns the value of attribute maxmemory.
9 10 11 |
# File 'lib/wafris/configuration.rb', line 9 def maxmemory @maxmemory end |
#quiet_mode ⇒ Object
Returns the value of attribute quiet_mode.
10 11 12 |
# File 'lib/wafris/configuration.rb', line 10 def quiet_mode @quiet_mode end |
#redis ⇒ Object
Returns the value of attribute redis.
7 8 9 |
# File 'lib/wafris/configuration.rb', line 7 def redis @redis end |
#redis_pool_size ⇒ Object
Returns the value of attribute redis_pool_size.
8 9 10 |
# File 'lib/wafris/configuration.rb', line 8 def redis_pool_size @redis_pool_size end |
Instance Method Details
#connection_pool ⇒ Object
18 19 20 21 |
# File 'lib/wafris/configuration.rb', line 18 def connection_pool @connection_pool ||= ConnectionPool.new(size: redis_pool_size) { redis } end |
#core_sha ⇒ Object
33 34 35 |
# File 'lib/wafris/configuration.rb', line 33 def core_sha @core_sha ||= redis.script(:load, wafris_core) end |
#create_settings ⇒ Object
23 24 25 26 27 28 29 30 31 |
# File 'lib/wafris/configuration.rb', line 23 def create_settings redis.hset('waf-settings', 'version', Wafris::VERSION, 'client', 'ruby', 'maxmemory', @maxmemory) LogSuppressor.puts_log( "[Wafris] firewall enabled. Connected to Redis on #{redis.connection[:host]}. Ready to process requests. Set rules at: https://wafris.org/hub" ) unless @quiet_mode end |
#wafris_core ⇒ Object
37 38 39 |
# File 'lib/wafris/configuration.rb', line 37 def wafris_core read_lua_dist("wafris_core") end |