Class: IpFilter::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/ip_filter/configuration.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/ip_filter/configuration.rb', line 9

def initialize
  # Folder containing GeoIP database files.
  @data_folder = '/tmp/geoip'
  # Level of filtering : Country, city...
  @geo_ip_dat = 'data/GeoIP.dat'
  @geoip_level = :country
  # Logic to use to update geoip.dat file
  @update_method = []
  # Must be 'country_code', 'country_code2', 'country_code3',
  # 'country_name', 'continent_code'
  @ip_code_type = nil
  # Must be of the corresponding format as :ip_code_type
  @ip_codes = []
  # Whitelist of IPs
  @ip_whitelist = []
  # Exceptions that should not be rescued by default
  # (if you want to implement custom error handling);
  @ip_exception = Exception.new
  # Allow loopback Ip
  @allow_loopback = true
  # cache object (must respond to #[], #[]=, and #keys)
  @cache = nil
  # prefix (string) to use for all cache keys
  @cache_prefix = 'ip_filter:'
  # Configuration path for geoipupdate binary
  @geoipupdate_config = '/usr/local/etc/GeoIP.conf'
  ## S3 credentials ##
  # if access_key_id is nil, S3 isn't loaded.
  @s3_access_key_id = nil
  # S3 Secret API key
  @s3_secret_access_key = nil
  # S3 bucket name
  @s3_bucket_name = 'ip_filter-geoip'
  # Cache refresh delay, every 24 hours by default
  @refresh_delay = 86400
end

Instance Attribute Details

#allow_loopbackObject

Returns the value of attribute allow_loopback.



3
4
5
# File 'lib/ip_filter/configuration.rb', line 3

def allow_loopback
  @allow_loopback
end

#cacheObject

Returns the value of attribute cache.



3
4
5
# File 'lib/ip_filter/configuration.rb', line 3

def cache
  @cache
end

#cache_prefixObject

Returns the value of attribute cache_prefix.



3
4
5
# File 'lib/ip_filter/configuration.rb', line 3

def cache_prefix
  @cache_prefix
end

#data_folderObject

Returns the value of attribute data_folder.



3
4
5
# File 'lib/ip_filter/configuration.rb', line 3

def data_folder
  @data_folder
end

#geo_ip_datObject

Returns the value of attribute geo_ip_dat.



3
4
5
# File 'lib/ip_filter/configuration.rb', line 3

def geo_ip_dat
  @geo_ip_dat
end

#geoip_levelObject

Returns the value of attribute geoip_level.



3
4
5
# File 'lib/ip_filter/configuration.rb', line 3

def geoip_level
  @geoip_level
end

#geoipupdate_configObject

Returns the value of attribute geoipupdate_config.



3
4
5
# File 'lib/ip_filter/configuration.rb', line 3

def geoipupdate_config
  @geoipupdate_config
end

#ip_code_typeObject

Returns the value of attribute ip_code_type.



3
4
5
# File 'lib/ip_filter/configuration.rb', line 3

def ip_code_type
  @ip_code_type
end

#ip_codesObject

Returns the value of attribute ip_codes.



3
4
5
# File 'lib/ip_filter/configuration.rb', line 3

def ip_codes
  @ip_codes
end

#ip_exceptionObject

Returns the value of attribute ip_exception.



3
4
5
# File 'lib/ip_filter/configuration.rb', line 3

def ip_exception
  @ip_exception
end

#ip_whitelistObject

Returns the value of attribute ip_whitelist.



3
4
5
# File 'lib/ip_filter/configuration.rb', line 3

def ip_whitelist
  @ip_whitelist
end

#refresh_delayObject

Returns the value of attribute refresh_delay.



3
4
5
# File 'lib/ip_filter/configuration.rb', line 3

def refresh_delay
  @refresh_delay
end

#s3_access_key_idObject

Returns the value of attribute s3_access_key_id.



3
4
5
# File 'lib/ip_filter/configuration.rb', line 3

def s3_access_key_id
  @s3_access_key_id
end

#s3_bucket_nameObject

Returns the value of attribute s3_bucket_name.



3
4
5
# File 'lib/ip_filter/configuration.rb', line 3

def s3_bucket_name
  @s3_bucket_name
end

#s3_secret_access_keyObject

Returns the value of attribute s3_secret_access_key.



3
4
5
# File 'lib/ip_filter/configuration.rb', line 3

def s3_secret_access_key
  @s3_secret_access_key
end

#update_methodObject

Returns the value of attribute update_method.



3
4
5
# File 'lib/ip_filter/configuration.rb', line 3

def update_method
  @update_method
end