Sha256: 712d8e8f59591398ad572cba11f58914752a8bb414c7e9eb56d5e1974aca54f7

Contents?: true

Size: 669 Bytes

Versions: 3

Compression:

Stored size: 669 Bytes

Contents

Inferno::Application.boot(:db) do
  init do
    use :logging

    require 'yaml'

    Sequel::Model.plugin :json_serializer

    config_path = File.expand_path('database.yml', File.join(Dir.pwd, 'config'))
    config = YAML.load_file(config_path)[ENV['APP_ENV']]
      .merge(logger: Inferno::Application['logger'])
    connection = Sequel.connect(config)

    register('db.config', config)
    register('db.connection', connection)
  end

  start do
    Sequel.extension :migration
    migration_path = File.join(Inferno::Application.root, 'lib', 'inferno', 'db', 'migrations')
    Sequel::Migrator.run(Inferno::Application['db.connection'], migration_path)
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
inferno_core-0.0.3 lib/inferno/config/boot/db.rb
inferno_core-0.0.2 lib/inferno/config/boot/db.rb
inferno_core-0.0.1 lib/inferno/config/boot/db.rb