Module: Legion::Data::Settings
- 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
- .cache ⇒ Object
- .connection ⇒ Object
- .creds(adapter = nil) ⇒ Object
- .default ⇒ Object
- .local ⇒ Object
- .migrations ⇒ Object
- .models ⇒ Object
Class Method Details
.cache ⇒ Object
82 83 84 85 86 87 88 |
# File 'lib/legion/data/settings.rb', line 82 def self.cache { connected: false, auto_enable: Legion::Settings[:cache][:connected], ttl: 60 } end |
.connection ⇒ Object
66 67 68 69 70 71 72 73 74 75 |
# File 'lib/legion/data/settings.rb', line 66 def self.connection { log: false, log_connection_info: false, log_warn_duration: 1, sql_log_level: 'debug', max_connections: 10, preconnect: false } end |
.creds(adapter = nil) ⇒ Object
77 78 79 80 |
# File 'lib/legion/data/settings.rb', line 77 def self.creds(adapter = nil) adapter = (adapter || :sqlite).to_sym CREDS.fetch(adapter, CREDS[:sqlite]).dup end |
.default ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/legion/data/settings.rb', line 26 def self.default { adapter: 'sqlite', connected: false, cache: cache, connection: connection, creds: creds, migrations: migrations, models: models, local: local, dev_mode: false, dev_fallback: true, connect_on_start: true } end |
.local ⇒ Object
42 43 44 45 46 47 48 |
# File 'lib/legion/data/settings.rb', line 42 def self.local { enabled: true, database: 'legionio_local.db', migrations: { auto_migrate: true } } end |
.migrations ⇒ Object
57 58 59 60 61 62 63 64 |
# File 'lib/legion/data/settings.rb', line 57 def self.migrations { continue_on_fail: false, auto_migrate: true, ran: false, version: nil } end |
.models ⇒ Object
50 51 52 53 54 55 |
# File 'lib/legion/data/settings.rb', line 50 def self.models { continue_on_load_fail: false, autoload: true } end |