Module: Legion::Data::Settings
- Extended by:
- Logging::Helper
- Defined in:
- lib/legion/data/settings.rb
Constant Summary collapse
- CREDS =
{ sqlite: { database: 'legionio.db' }, mysql2: { username: 'legion', password: 'legion', database: 'legionio', host: '127.0.0.1', port: 3306 }, postgres: { user: 'legion', password: 'legion', database: 'legionio', host: '127.0.0.1', port: 5432 } }.freeze
Class Method Summary collapse
- .archival ⇒ Object
- .cache ⇒ Object
- .creds(adapter = nil) ⇒ Object
- .default ⇒ Object
- .local ⇒ Object
- .migrations ⇒ Object
- .models ⇒ Object
Methods included from Logging::Helper
Class Method Details
.archival ⇒ Object
115 116 117 118 119 120 121 |
# File 'lib/legion/data/settings.rb', line 115 def self.archival { retention_days: 90, batch_size: 1000, storage_backend: nil } end |
.cache ⇒ Object
123 124 125 126 127 128 129 130 |
# File 'lib/legion/data/settings.rb', line 123 def self.cache { connected: false, auto_enable: Legion::Settings[:cache][:connected], static_cache: false, ttl: 60 } end |
.creds(adapter = nil) ⇒ Object
110 111 112 113 |
# File 'lib/legion/data/settings.rb', line 110 def self.creds(adapter = nil) adapter = (adapter || :sqlite).to_sym CREDS.fetch(adapter, CREDS[:sqlite]).dup end |
.default ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 |
# File 'lib/legion/data/settings.rb', line 30 def self.default { adapter: 'sqlite', connected: false, # Connection pool max_connections: 25, pool_timeout: 5, preconnect: false, single_threaded: false, test: true, name: nil, # Logging log: false, query_log: false, log_connection_info: false, log_warn_duration: 1, sql_log_level: 'debug', # Connection health (network adapters only, ignored for sqlite) # -1 means validate on every checkout, catching stale connections from VPN/sleep/network changes immediately connection_validation: true, connection_validation_timeout: -1, connection_expiration: true, connection_expiration_timeout: 14_400, # Adapter-specific (nil = use adapter built-in default) connect_timeout: nil, read_timeout: nil, write_timeout: nil, encoding: nil, sql_mode: nil, sslmode: nil, sslrootcert: nil, search_path: nil, timeout: nil, readonly: nil, disable_dqs: nil, # Grouped settings creds: creds, cache: cache, migrations: migrations, models: models, local: local, dev_mode: false, dev_fallback: true, connect_on_start: true, read_replica_url: nil, replicas: [], archival: archival } end |
.local ⇒ Object
85 86 87 88 89 90 91 92 |
# File 'lib/legion/data/settings.rb', line 85 def self.local { enabled: true, database: 'legionio_local.db', query_log: false, migrations: { auto_migrate: true } } end |
.migrations ⇒ Object
101 102 103 104 105 106 107 108 |
# File 'lib/legion/data/settings.rb', line 101 def self.migrations { continue_on_fail: false, auto_migrate: true, ran: false, version: nil } end |
.models ⇒ Object
94 95 96 97 98 99 |
# File 'lib/legion/data/settings.rb', line 94 def self.models { continue_on_load_fail: false, autoload: true } end |