Farmbot-Web-App/config/application.rb

48 lines
2.0 KiB
Ruby
Raw Normal View History

2014-03-12 07:42:11 -06:00
require File.expand_path('../boot', __FILE__)
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)
module FarmBot
2014-03-12 07:42:11 -06:00
class Application < Rails::Application
2014-06-12 19:05:29 -06:00
# Settings in config/environments/* take precedence over those specified
# here. Application configuration should go into files in
# config/initializers
2014-03-12 07:42:11 -06:00
# -- all .rb files in that directory are automatically loaded.
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
# config.time_zone = 'Central Time (US & Canada)'
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
# config.i18n.default_locale = :de
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
config.autoload_paths << Rails.root.join('lib')
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
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