60 lines
1.6 KiB
Plaintext
60 lines
1.6 KiB
Plaintext
require 'hanami/model'
|
|
require 'hanami/mailer'
|
|
Dir["#{ __dir__ }/<%= config[:app_name] %>/**/*.rb"].each { |file| require_relative file }
|
|
|
|
Hanami::Model.configure do
|
|
# Database adapter
|
|
#
|
|
# Available options:
|
|
#
|
|
# * Memory adapter
|
|
# adapter type: :memory, uri: 'memory://localhost/<%= config[:app_name] %>_development'
|
|
#
|
|
# * SQL adapter
|
|
# adapter type: :sql, uri: 'sqlite://db/<%= config[:app_name] %>_development.sqlite3'
|
|
# adapter type: :sql, uri: 'postgres://localhost/<%= config[:app_name] %>_development'
|
|
# adapter type: :sql, uri: 'mysql://localhost/<%= config[:app_name] %>_development'
|
|
#
|
|
adapter type: :<%= config[:database_config][:type] %>, uri: ENV['<%= config[:app_name].to_env_s %>_DATABASE_URL']
|
|
|
|
<%- if config[:database_config][:type] == :sql -%>
|
|
##
|
|
# Migrations
|
|
#
|
|
migrations 'db/migrations'
|
|
schema 'db/schema.sql'
|
|
|
|
<%- end -%>
|
|
##
|
|
# Database mapping
|
|
#
|
|
# Intended for specifying application wide mappings.
|
|
#
|
|
# You can specify mapping file to load with:
|
|
#
|
|
# mapping "#{__dir__}/config/mapping"
|
|
#
|
|
# Alternatively, you can use a block syntax like the following:
|
|
#
|
|
mapping do
|
|
# collection :users do
|
|
# entity User
|
|
# repository UserRepository
|
|
#
|
|
# attribute :id, Integer
|
|
# attribute :name, String
|
|
# end
|
|
end
|
|
end.load!
|
|
|
|
Hanami::Mailer.configure do
|
|
root "#{ __dir__ }/<%= config[:app_name] %>/mailers"
|
|
|
|
# See http://hanamirb.org/guides/mailers/delivery
|
|
delivery do
|
|
development :test
|
|
test :test
|
|
# production :stmp, address: ENV['SMTP_PORT'], port: 1025
|
|
end
|
|
end.load!
|