Class: RailsMaint::Configuration

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

Constant Summary collapse

ALLOWED_LOCALE_PATTERN =
/\A[a-z]{2}(-[A-Z]{2})?\z/

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



13
14
15
16
17
18
19
20
21
22
23
# File 'lib/rails_maint/configuration.rb', line 13

def initialize
  @locale = 'en'
  @white_listed_ips = []
  @maintenance_file_path = 'tmp/maintenance_mode.txt'
  @custom_page_path = nil
  @config_file_path = 'config/rails_maint.yml'
  @retry_after = 3600
  @bypass_paths = []
  @maintenance_paths = []
  @webhook_url = nil
end

Instance Attribute Details

#bypass_pathsObject

Returns the value of attribute bypass_paths.



9
10
11
# File 'lib/rails_maint/configuration.rb', line 9

def bypass_paths
  @bypass_paths
end

#config_file_pathObject

Returns the value of attribute config_file_path.



9
10
11
# File 'lib/rails_maint/configuration.rb', line 9

def config_file_path
  @config_file_path
end

#custom_page_pathObject

Returns the value of attribute custom_page_path.



9
10
11
# File 'lib/rails_maint/configuration.rb', line 9

def custom_page_path
  @custom_page_path
end

#localeObject

Returns the value of attribute locale.



9
10
11
# File 'lib/rails_maint/configuration.rb', line 9

def locale
  @locale
end

#maintenance_file_pathObject

Returns the value of attribute maintenance_file_path.



9
10
11
# File 'lib/rails_maint/configuration.rb', line 9

def maintenance_file_path
  @maintenance_file_path
end

#maintenance_pathsObject

Returns the value of attribute maintenance_paths.



9
10
11
# File 'lib/rails_maint/configuration.rb', line 9

def maintenance_paths
  @maintenance_paths
end

#retry_afterObject

Returns the value of attribute retry_after.



9
10
11
# File 'lib/rails_maint/configuration.rb', line 9

def retry_after
  @retry_after
end

#webhook_urlObject

Returns the value of attribute webhook_url.



9
10
11
# File 'lib/rails_maint/configuration.rb', line 9

def webhook_url
  @webhook_url
end

#white_listed_ipsObject

Returns the value of attribute white_listed_ips.



9
10
11
# File 'lib/rails_maint/configuration.rb', line 9

def white_listed_ips
  @white_listed_ips
end

Instance Method Details

#validate!Object



25
26
27
28
29
# File 'lib/rails_maint/configuration.rb', line 25

def validate!
  validate_locale!
  validate_retry_after!
  validate_webhook_url!
end