From f5a133a14ed345673412f6eac7c72cb97cc1c362 Mon Sep 17 00:00:00 2001 From: Sneha Mishra <33183263+Tlazypanda@users.noreply.github.com> Date: Wed, 22 Jul 2020 00:45:55 +0530 Subject: [PATCH] add environments to skylight (#8104) --- config/application.rb | 11 +-- config/environments/staging.rb | 89 +++++++++++++++++++++++++ config/environments/staging_unstable.rb | 89 +++++++++++++++++++++++++ 3 files changed, 185 insertions(+), 4 deletions(-) create mode 100644 config/environments/staging.rb create mode 100644 config/environments/staging_unstable.rb diff --git a/config/application.rb b/config/application.rb index 3b1f4aa3f9..3cba9d01ea 100644 --- a/config/application.rb +++ b/config/application.rb @@ -54,15 +54,15 @@ class Application < Rails::Application # Enable the asset pipeline config.assets.enabled = true - + I18n.available_locales = [:en, :de, "zh-CN", :ar, :es, "hi-IN", :it, :ko, "pt-BR", :ru] - config.i18n.default_locale = :en - + config.i18n.default_locale = :en + config.i18n.load_path += Dir[Rails.root.join('config', 'locales', '**', '*.{rb,yml}')] # rails will fallback to config.i18n.default_locale translation config.i18n.fallbacks = true - + # rails will fallback to en, no matter what is set as config.i18n.default_locale config.i18n.fallbacks = [:en] @@ -80,6 +80,9 @@ class Application < Rails::Application config.less.paths << Rails.root.join("assets","less") config.less.compress = true + # Add environments to skylight + config.skylight.environments += ["staging_unstable", "staging"] + ActiveRecord::SessionStore::Session.table_name = 'rsessions' config.after_initialize do diff --git a/config/environments/staging.rb b/config/environments/staging.rb new file mode 100644 index 0000000000..5619c9080c --- /dev/null +++ b/config/environments/staging.rb @@ -0,0 +1,89 @@ +Plots2::Application.configure do + # Settings specified here will take precedence over those in config/application.rb + + # Code is not reloaded between requests + config.cache_classes = true + + config.eager_load = true + + # Full error reports are disabled and caching is turned on + config.consider_all_requests_local = false + config.action_controller.perform_caching = true + + # Disable Rails's static asset server (Apache or nginx will already do this) + config.serve_static_assets = false + + # Compress JavaScripts and CSS + config.assets.compress = true + config.assets.js_compressor = Uglifier.new(harmony: true) + + # Don't fallback to assets pipeline if a precompiled asset is missed + config.assets.compile = true + + # Generate digests for assets URLs + config.assets.digest = true + + # Add non-concatenated scripts + config.assets.precompile += ['dragdrop.js', 'post.js'] + + # Defaults to nil and saved in location specified by config.assets.prefix + # config.assets.manifest = YOUR_PATH + + # Specifies the header that your server uses for sending files + # config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache + # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx + + # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies. + # config.force_ssl = true + # config.middleware.insert_before ActionDispatch::Static, Rack::SSL, :exclude => proc { |env| env['HTTPS'] != 'on' } + + # Set to `:info` to match the current default, or set to `:debug` to opt-into + # the future default. + config.log_level = :info + + # Prepend all log lines with the following tags + config.log_tags = [ :request_id ] + + # Use a different logger for distributed setups + # config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new) + + # Use a different cache store in production + # config.cache_store = :mem_cache_store + + # Use a real queuing backend for Active Job (and separate queues per environment) + config.active_job.queue_adapter = :sidekiq + # config.active_job.queue_name_prefix = "railsdiff_#{Rails.env}" + config.action_mailer.perform_caching = false + + # Precompile additional assets (application.js, application.css, and all non-JS/CSS are already added) + # config.assets.precompile += %w( search.js ) + + # Disable delivery errors, bad email addresses will be ignored + # config.action_mailer.raise_delivery_errors = false + # config.action_mailer.delivery_method = :sendmail + + config.action_mailer.delivery_method = :smtp + + config.action_mailer.smtp_settings = { + :address => "smtp", + :port => 25, + } + + # Enable threaded mode + # config.threadsafe! + + config.action_cable.allowed_request_origins = [/http:\/\/*/, /https:\/\/*/] + + # Enable locale fallbacks for I18n (makes lookups for any locale fall back to + # the I18n.default_locale when a translation can not be found) + config.i18n.fallbacks = true + + # Send deprecation notices to registered listeners + config.active_support.deprecation = :notify + + config.action_mailer.default_url_options = { + host: 'stable.publiclab.org' + } + config.action_controller.default_url_options = { host: 'stable.publiclab.org' } + +end diff --git a/config/environments/staging_unstable.rb b/config/environments/staging_unstable.rb new file mode 100644 index 0000000000..0ad2184817 --- /dev/null +++ b/config/environments/staging_unstable.rb @@ -0,0 +1,89 @@ +Plots2::Application.configure do + # Settings specified here will take precedence over those in config/application.rb + + # Code is not reloaded between requests + config.cache_classes = true + + config.eager_load = true + + # Full error reports are disabled and caching is turned on + config.consider_all_requests_local = false + config.action_controller.perform_caching = true + + # Disable Rails's static asset server (Apache or nginx will already do this) + config.serve_static_assets = false + + # Compress JavaScripts and CSS + config.assets.compress = true + config.assets.js_compressor = Uglifier.new(harmony: true) + + # Don't fallback to assets pipeline if a precompiled asset is missed + config.assets.compile = true + + # Generate digests for assets URLs + config.assets.digest = true + + # Add non-concatenated scripts + config.assets.precompile += ['dragdrop.js', 'post.js'] + + # Defaults to nil and saved in location specified by config.assets.prefix + # config.assets.manifest = YOUR_PATH + + # Specifies the header that your server uses for sending files + # config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache + # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx + + # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies. + # config.force_ssl = true + # config.middleware.insert_before ActionDispatch::Static, Rack::SSL, :exclude => proc { |env| env['HTTPS'] != 'on' } + + # Set to `:info` to match the current default, or set to `:debug` to opt-into + # the future default. + config.log_level = :info + + # Prepend all log lines with the following tags + config.log_tags = [ :request_id ] + + # Use a different logger for distributed setups + # config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new) + + # Use a different cache store in production + # config.cache_store = :mem_cache_store + + # Use a real queuing backend for Active Job (and separate queues per environment) + config.active_job.queue_adapter = :sidekiq + # config.active_job.queue_name_prefix = "railsdiff_#{Rails.env}" + config.action_mailer.perform_caching = false + + # Precompile additional assets (application.js, application.css, and all non-JS/CSS are already added) + # config.assets.precompile += %w( search.js ) + + # Disable delivery errors, bad email addresses will be ignored + # config.action_mailer.raise_delivery_errors = false + # config.action_mailer.delivery_method = :sendmail + + config.action_mailer.delivery_method = :smtp + + config.action_mailer.smtp_settings = { + :address => "smtp", + :port => 25, + } + + # Enable threaded mode + # config.threadsafe! + + config.action_cable.allowed_request_origins = [/http:\/\/*/, /https:\/\/*/] + + # Enable locale fallbacks for I18n (makes lookups for any locale fall back to + # the I18n.default_locale when a translation can not be found) + config.i18n.fallbacks = true + + # Send deprecation notices to registered listeners + config.active_support.deprecation = :notify + + config.action_mailer.default_url_options = { + host: 'unstable.publiclab.org' + } + config.action_controller.default_url_options = { host: 'unstable.publiclab.org' } + +end