diff options
author | Jonne Haß <me@mrzyx.de> | 2013-05-05 15:45:49 +0400 |
---|---|---|
committer | Jonne Haß <me@mrzyx.de> | 2013-05-19 20:54:54 +0400 |
commit | ac147cc9f438f0d7a374b27a155d8e1fc4952df7 (patch) | |
tree | d90e2ce7912634e3d99911a8380333cb48ece78e /config/environment.rb | |
parent | bf90dfffbda9219d59c020b1babafbec5c2bbfc8 (diff) |
Refactor config/ directory
* Get rid of early pathname requirement
* Use require_relative where approciate
* Drop unused files
* Imported new application.rb, environment.rb and environments/* from fresh Rails app
* Cleaned up boot.rb
* Load config in boot.rb
* Deduplicate environments/integration*.rb
* Move username blacklist into defaults.yml
* Ruby 1.9 Hash syntax everywhere
* Reorganize lib/diaspora/markdownify to match conventions
* Get rid of full path requires where possible
* Add dummy content to production section diaspora.yml.example to prevent warning
* Drop sqlite? method
* Move postgres? method into ConfigurationMethods
* Drop token authentication from User
Diffstat (limited to 'config/environment.rb')
-rw-r--r-- | config/environment.rb | 41 |
1 files changed, 1 insertions, 40 deletions
diff --git a/config/environment.rb b/config/environment.rb index 4731a494a..c9482d0ee 100644 --- a/config/environment.rb +++ b/config/environment.rb @@ -1,44 +1,5 @@ -# Copyright (c) 2010-2011, Diaspora Inc. This file is -# licensed under the Affero General Public License version 3 or later. See -# the COPYRIGHT file. - -# check what database you have -def postgres? - @using_postgres ||= defined?(ActiveRecord::ConnectionAdapters::PostgreSQLAdapter) && ActiveRecord::Base.connection.is_a?(ActiveRecord::ConnectionAdapters::PostgreSQLAdapter) -end - -def sqlite? - @using_sqlite ||= defined?(ActiveRecord::ConnectionAdapters::SQLite3Adapter) && ActiveRecord::Base.connection.class == ActiveRecord::ConnectionAdapters::SQLite3Adapter -end - # Load the rails application -require Pathname.new(__FILE__).dirname.expand_path.join('application') - -# Load configuration system early -require Rails.root.join('config', 'load_config') - -Haml::Template.options[:format] = :html5 -Haml::Template.options[:escape_html] = true - -# Blacklist of usernames -USERNAME_BLACKLIST = ['admin', 'administrator', 'hostmaster', 'info', 'postmaster', 'root', 'ssladmin', - 'ssladministrator', 'sslwebmaster', 'sysadmin', 'webmaster', 'support', 'contact', 'example_user1dsioaioedfhgoiesajdigtoearogjaidofgjo'] +require_relative 'application' # Initialize the rails application Diaspora::Application.initialize! - -# allow token auth only for posting activitystream photos -module Devise - module Strategies - class TokenAuthenticatable < Authenticatable - private - def valid_params_request? - params[:controller] == "activity_streams/photos" && params[:action] == "create" - end - end - end -end - - -# Ensure Builder is loaded -require 'active_support/builder' unless defined?(Builder) |