Module: CoreSystemConfiguration

Extended by:
ActiveSupport::Concern
Defined in:
lib/app/models/concerns/core_system_configuration.rb

Overview

The System configuration. Various configuration items that can be updated/defined at run time

Use of this class allows you to simply ask for the configuration parameter directly without first having to get an instance of it.

SystemConfiguration.queue_impl #=> ‘RedisQueue’

This method only is allowed for accessors, you should NEVER set values on the SystemConfiguration unless you are updating via the Admin or Stack UI, or during testing to setup a specific configuration for that.

Defined Under Namespace

Modules: ClassMethods

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



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
45
46
47
48
# File 'lib/app/models/concerns/core_system_configuration.rb', line 18

def self.included(base)
  base.class_eval do
    attr_accessor :configuration

    #
    # Fields
    #
    field :environment, type: String, default: 'test'
    field :fips_mode, type: Mongoid::Boolean, default: false
    field :fav_icon_path, { type: String, default: '/favicon.ico' }
    field :stack_logo_path, { type: String, default: 'ui-company-logo.png' }
    field :primary_stylesheet, { type: String, default: 'app47' }
    field :short_cache, { type: Integer, default: 1 }
    field :medium_cache, { type: Integer, default: 5 }
    field :long_cache, { type: Integer, default: 15 }
    # URLs
    field :base_url, type: String
    field :cdn_url, type: String
    field :asset_cdn_url, type: String
    # Time Zone Support
    field :default_time_zone, type: String, default: 'US/Eastern'
    # TTLs
    field :user_model_audit_log_ttl, type: Integer, default: 365
    #
    # Validations
    #
    validates :environment, presence: true, uniqueness: true
    validates :default_time_zone, presence: true
  end
  base.extend ClassMethods
end

Instance Method Details

#long_cache_timeObject



89
90
91
# File 'lib/app/models/concerns/core_system_configuration.rb', line 89

def long_cache_time
  long_cache.minutes
end

#medium_cache_timeObject



85
86
87
# File 'lib/app/models/concerns/core_system_configuration.rb', line 85

def medium_cache_time
  medium_cache.minutes
end

#short_cache_timeObject

Cache times in minutes



81
82
83
# File 'lib/app/models/concerns/core_system_configuration.rb', line 81

def short_cache_time
  short_cache.minutes
end