Sha256: 450dcc1d13c7ce64dab8eb579e22eab817be64217a1f4f10a668dbbcaee4e3dc

Contents?: true

Size: 1.42 KB

Versions: 1

Compression:

Stored size: 1.42 KB

Contents

require 'bundler'
Bundler.require :default, ENV['NYARA_ENV'] || 'development'

configure do
  set :env, ENV['NYARA_ENV'] || 'development'

  set :port, ENV['NYARA_PORT']

  # directory containing view templates
  set :views, 'app/views'

  ## change cookie based session name
  # set :session, :name, '_aaa'

  ## if you've configured https with nginx:
  # set :session, :secure, true

  ## default session expires when browser closes.
  ## if you need time-based expiration, 30 minutes for example:
  # set :session, :expires, 30 * 60

  # you can regenerate session key with `nyara g session.key`
  set 'session', 'key', File.read(project_path 'config/session.key')

  # map routing prefix to controllers
  map '/', 'HomeController'

  # environment specific configure at last
  require_relative env

  # invoked after forking a worker
  set :after_fork, ->{
    <%- case orm -%>
    <%- when 'mongoid' -%>
    Mongoid.load!(Nyara.config.project_path('config/database.yml'), Nyara.config.env)
    <%- when 'activerecord' -%>
    ActiveRecord::Base.establish_connection Nyara.config.project_path('config/database.yml')
    <%- end -%>
  }
end

# load app
Dir.glob %w|
  app/controllers/application_controller.rb
  app/{helpers,models,controllers}/**/*.rb
| do |file|
  require_relative "../#{file}"
end

# compile routes and finish misc setup stuffs
Nyara.setup

# connect db in interactive shell
Nyara.config[:after_fork].call if ENV['NYARA_SHELL']

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
nyara-0.1.pre.2 lib/nyara/templates/config/application.rb.tt