Sha256: e8f257a8297efad1368a5ec93a8b907f19c050e3babb6515a34c5ac4d5d72011

Contents?: true

Size: 981 Bytes

Versions: 4

Compression:

Stored size: 981 Bytes

Contents

<%= config[:camel_cased_app_name] %>::Container.namespace :persistence do |container|
  container.finalize :rom do
    init do
      require "sequel"
      require "rom"
      require "rom/sql"

      use :settings
      use :monitor

      ROM::SQL.load_extensions :postgres

      Sequel.database_timezone = :utc
      Sequel.application_timezone = :local

      rom_config = ROM::Configuration.new(
        :sql,
        container["settings"].database_url,
        extensions: %i[error_sql pg_array pg_json],
      )

      rom_config.plugin :sql, relations: :instrumentation do |plugin_config|
        plugin_config.notifications = notifications
      end

      rom_config.plugin :sql, relations: :auto_restrictions

      container.register "config", rom_config
      container.register "db", rom_config.gateways[:default].connection
    end

    start do
      config = container["persistence.config"]
      container.register "rom", ROM.container(config)
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
kanji-web-0.2.2 lib/kanji/templates/system/boot/rom.rb.tt
kanji-web-0.2.1 lib/kanji/templates/system/boot/rom.rb.tt
kanji-web-0.2.0 lib/kanji/templates/system/boot/rom.rb.tt
kanji-web-0.1.0 lib/kanji/templates/system/boot/rom.rb.tt