2014-03-12 07:42:11 -06:00
|
|
|
require File.expand_path('../boot', __FILE__)
|
|
|
|
|
2016-08-19 23:24:00 -06:00
|
|
|
require "rails/all"
|
2014-03-12 07:42:11 -06:00
|
|
|
# Require the gems listed in Gemfile, including any gems
|
|
|
|
# you've limited to :test, :development, or :production.
|
|
|
|
Bundler.require(:default, Rails.env)
|
|
|
|
|
2015-03-09 04:31:05 -06:00
|
|
|
module FarmBot
|
2014-03-12 07:42:11 -06:00
|
|
|
class Application < Rails::Application
|
2017-01-11 08:27:06 -07:00
|
|
|
config.active_job.queue_adapter = :delayed_job
|
2016-05-09 09:08:42 -06:00
|
|
|
config.action_dispatch.perform_deep_munge = false
|
2014-05-22 07:42:45 -06:00
|
|
|
I18n.enforce_available_locales = false
|
2014-05-08 08:02:51 -06:00
|
|
|
config.generators do |g|
|
2016-12-01 11:50:07 -07:00
|
|
|
g.template_engine :erb
|
2014-05-08 08:02:51 -06:00
|
|
|
g.test_framework :rspec, :fixture_replacement => :factory_girl, :views => false, :helper => false
|
|
|
|
g.view_specs false
|
|
|
|
g.helper_specs false
|
|
|
|
g.fixture_replacement :factory_girl, :dir => 'spec/factories'
|
|
|
|
end
|
2015-01-12 06:14:18 -07:00
|
|
|
config.autoload_paths << Rails.root.join('lib')
|
2016-12-15 13:11:48 -07:00
|
|
|
config.autoload_paths << Rails.root.join('lib/sequence_migrations')
|
2016-11-23 11:40:22 -07:00
|
|
|
config.middleware.insert_before ActionDispatch::Static, Rack::Cors do
|
2015-10-20 13:25:08 -06:00
|
|
|
allow do
|
|
|
|
origins '*'
|
|
|
|
resource '/api/*',
|
|
|
|
headers: :any,
|
|
|
|
methods: [:get, :post, :delete, :put, :patch, :options, :head],
|
|
|
|
credentials: false, # No cookies.
|
|
|
|
max_age: 0
|
|
|
|
end
|
|
|
|
end
|
2016-12-15 13:11:48 -07:00
|
|
|
Rails.application.routes.default_url_options[:host] = ENV["API_HOST"] || "localhost"
|
2016-09-14 15:14:12 -06:00
|
|
|
Rails.application.routes.default_url_options[:port] = ENV["API_PORT"] || 3000
|
2016-11-08 15:09:46 -07:00
|
|
|
# ¯\_(ツ)_/¯
|
|
|
|
$API_URL = "//#{ Rails.application.routes.default_url_options[:host] }:#{ Rails.application.routes.default_url_options[:port] }"
|
2014-03-12 07:42:11 -06:00
|
|
|
end
|
|
|
|
end
|