Commit 2a4db54d authored by Jonne Haß's avatar Jonne Haß

New configuration system

* Throw away old system
* Add new system
* Add new example files
* Replace all calls
* add the most important docs
* Add Specs
* rename disable_ssl_requirement to require_ssl
* cloudfiles isn't used/called in our code
* since community_spotlight.list is only used as enable flag replace it with such one and remove all legacy and irelevant codepaths around it
* die if session secret is unset and on heroku
* First basic infrastructure for version information
parent 5bea6309
......@@ -4,13 +4,9 @@ app/assets/images/custom/*
# Configuration files
config/app_config.yml
config/app.yml
config/application.yml
config/diaspora.yml
config/heroku.yml
config/script_server*.yml
config/fb_config.yml
config/oauth_keys.yml
config/script_server.yml
config/initializers/secret_token.rb
config/redis.conf
config/deploy_config.yml
......
# 0.0.1.0pre
## New configuration system!
Copy over config/diaspora.yml.example to config/diaspora.yml and migrate your settings! An updated Heroku guide including basic hints on howto migrate is [here](https://github.com/diaspora/diaspora/wiki/Installing-on-heroku).
The new configuration system allows all possible settings to be overriden by environment variables. This makes it possible to deploy heroku without checking any credentials into git. Read the top of `config/diaspora.yml.example` for an explanation on how to convert the setting names to environment variables.
### Environment variable changes:
#### deprectated
* REDISTOGO_URL in favour of REDIS_URL or ENVIRONMENT_REDIS
#### removed
* application_yml - Obsolete, all settings are settable via environment variables now
#### renamed
* SINGLE_PROCESS_MODE -> ENVIRONMENT_SINGLE_PROCESS_MODE
* SINGLE_PROCESS -> ENVIRONMENT_SINGLE_PROCESS_MODE
* NO_SSL -> ENVIRONMENT_REQUIRE_SSL
* ASSET_HOST -> ENVIRONMENT_ASSETS_HOST
\ No newline at end of file
......@@ -53,7 +53,6 @@ group :heroku do
gem 'unicorn', '4.3.1', :require => false
end
gem 'settingslogic', :git => 'https://github.com/binarylogic/settingslogic.git'
# database
gem "activerecord-import", "0.2.11"
......
......@@ -7,12 +7,6 @@ GIT
activesupport (>= 2.3.0)
nokogiri (>= 1.3.3)
GIT
remote: https://github.com/binarylogic/settingslogic.git
revision: 4884d455bf18d92723cb8190cfd2dbf87f3aafd5
specs:
settingslogic (2.0.8)
GIT
remote: https://github.com/plataformatec/markerb.git
revision: 93b1e8bea9b8fa89ef930f78ba562f596c022198
......@@ -519,7 +513,6 @@ DEPENDENCIES
ruby-oembed (= 0.8.7)
sass-rails (= 3.2.5)
selenium-webdriver (= 2.25.0)
settingslogic!
spork (= 1.0.0rc3)
thin (= 1.4.1)
timecop (= 0.5.1)
......
......@@ -8,7 +8,7 @@ class ApplicationController < ActionController::Base
before_filter :ensure_http_referer_is_set
before_filter :set_locale
before_filter :set_git_header if (AppConfig[:git_update] && AppConfig[:git_revision])
before_filter :set_diaspora_header
before_filter :set_grammatical_gender
before_filter :mobile_switch
......@@ -61,9 +61,13 @@ class ApplicationController < ActionController::Base
params[:page] = params[:page] ? params[:page].to_i : 1
end
def set_git_header
headers['X-Git-Update'] = AppConfig[:git_update] if AppConfig[:git_update].present?
headers['X-Git-Revision'] = AppConfig[:git_revision] if AppConfig[:git_revision].present?
def set_diaspora_header
headers['X-Diaspora-Version'] = AppConfig.version_string
if AppConfig.git_available?
headers['X-Git-Update'] = AppConfig.git_update if AppConfig.git_update.present?
headers['X-Git-Revision'] = AppConfig.git_revision if AppConfig.git_revision.present?
end
end
def set_locale
......
......@@ -55,7 +55,7 @@ class InvitationsController < ApplicationController
end
def check_if_invites_open
unless AppConfig[:open_invitations]
unless AppConfig.settings.invitations.open?
flash[:error] = I18n.t 'invitations.create.no_more'
redirect_to :back
......
......@@ -9,12 +9,6 @@ class PublicsController < ApplicationController
require Rails.root.join('lib', 'postzord', 'receiver', 'private')
include Diaspora::Parser
# We use newrelic_ignore to prevent artifical RPM bloat; however,
# I am commenting this line out for the time being to debug some apparent
# issues on Heroku.
#
# newrelic_ignore if EnvironmentConfiguration.using_new_relic?
skip_before_filter :set_header_data
skip_before_filter :set_grammatical_gender
before_filter :check_for_xml, :only => [:receive, :receive_public]
......
......@@ -31,7 +31,7 @@ class RegistrationsController < Devise::RegistrationsController
private
def check_valid_invite!
return true unless AppConfig[:registrations_closed] #this sucks
return true if AppConfig.settings.enable_registrations? #this sucks
return true if invite && invite.can_be_used?
flash[:error] = t('registrations.invalid_invite')
redirect_to new_user_session_path
......@@ -39,7 +39,7 @@ class RegistrationsController < Devise::RegistrationsController
def check_registrations_open_or_vaild_invite!
return true if invite.present?
if AppConfig[:registrations_closed]
unless AppConfig.settings.enable_registrations?
flash[:error] = t('registrations.closed')
redirect_to new_user_session_path
end
......
......@@ -9,7 +9,7 @@ module AnalyticsHelper
<<-JS.html_safe
(function(d,c){var a,b,g,e;a=d.createElement('script');a.type='text/javascript';a.async=!0;a.src=('https:'===d.location.protocol?'https:':'http:')+'//api.mixpanel.com/site_media/js/api/mixpanel.2.js';b=d.getElementsByTagName('script')[0];b.parentNode.insertBefore(a,b);c._i=[];c.init=function(a,d,f){var b=c;'undefined'!==typeof f?b=c[f]=[]:f='mixpanel';g='disable track track_pageview track_links track_forms register register_once unregister identify name_tag set_config'.split(' ');
for(e=0;e<g.length;e++)(function(a){b[a]=function(){b.push([a].concat(Array.prototype.slice.call(arguments,0)))}})(g[e]);c._i.push([a,d,f])};window.mixpanel=c})(document,[]);
mixpanel.init("#{AppConfig[:mixpanel_uid]}");
mixpanel.init("#{AppConfig.privacy.mixpanel_uid}");
JS
end
end
......@@ -35,7 +35,7 @@ module AnalyticsHelper
include_analytics "chartbeat" do
javascript_tag do
<<-JS.html_safe
var _sf_async_config = { uid: #{AppConfig[:chartbeat_uid]}, domain: "#{AppConfig[:pod_uri].host}" };
var _sf_async_config = { uid: #{AppConfig.privacy.chartbeat_uid}, domain: "#{AppConfig.pod_uri.host}" };
(function() {
function loadChartbeat() {
window._sf_endpt = (new Date()).getTime();
......@@ -64,6 +64,6 @@ module AnalyticsHelper
end
def configured?(service)
AppConfig["#{service}_uid".to_sym].present?
AppConfig.privacy.send("#{service}_uid").present?
end
end
\ No newline at end of file
end
......@@ -4,7 +4,7 @@
module ApplicationHelper
def pod_name
AppConfig[:pod_name].present? ? AppConfig[:pod_name] : "DIASPORA*"
AppConfig.settings.pod_name.present? ? AppConfig.settings.pod_name : "DIASPORA*"
end
def how_long_ago(obj)
......@@ -21,7 +21,7 @@ module ApplicationHelper
end
def raw_bookmarklet( height = 250, width = 620)
"javascript:(function(){f='#{AppConfig[:pod_url]}bookmarklet?url='+encodeURIComponent(window.location.href)+'&title='+encodeURIComponent(document.title)+'&notes='+encodeURIComponent(''+(window.getSelection?window.getSelection():document.getSelection?document.getSelection():document.selection.createRange().text))+'&v=1&';a=function(){if(!window.open(f+'noui=1&jump=doclose','diasporav1','location=yes,links=no,scrollbars=no,toolbar=no,width=#{width},height=#{height}'))location.href=f+'jump=yes'};if(/Firefox/.test(navigator.userAgent)){setTimeout(a,0)}else{a()}})()"
"javascript:(function(){f='#{AppConfig.environment.url}bookmarklet?url='+encodeURIComponent(window.location.href)+'&title='+encodeURIComponent(document.title)+'&notes='+encodeURIComponent(''+(window.getSelection?window.getSelection():document.getSelection?document.getSelection():document.selection.createRange().text))+'&v=1&';a=function(){if(!window.open(f+'noui=1&jump=doclose','diasporav1','location=yes,links=no,scrollbars=no,toolbar=no,width=#{width},height=#{height}'))location.href=f+'jump=yes'};if(/Firefox/.test(navigator.userAgent)){setTimeout(a,0)}else{a()}})()"
end
def magic_bookmarklet_link
......@@ -37,7 +37,7 @@ module ApplicationHelper
end
def all_services_connected?
current_user.services.size == AppConfig[:configured_services].size
current_user.services.size == AppConfig.configured_services.size
end
def popover_with_close_html(without_close_html)
......@@ -56,7 +56,7 @@ module ApplicationHelper
# vendored jquery_ujs
def jquery_include_tag
buf = []
if AppConfig[:jquery_cdn]
if AppConfig.privacy.jquery_cdn?
version = Jquery::Rails::JQUERY_VERSION
buf << [ javascript_include_tag("//ajax.googleapis.com/ajax/libs/jquery/#{version}/jquery.min.js") ]
buf << [ javascript_tag("!window.jQuery && document.write(unescape('#{j javascript_include_tag("jquery")}'));") ]
......
......@@ -30,7 +30,7 @@ module OpenGraphHelper
end
def og_namespace(object)
namespace = AppConfig[:open_graph_namespace].present? ? AppConfig[:open_graph_namespace] : 'joindiaspora'
namespace = AppConfig.services.facebook.open_graph_namespace.present? ? AppConfig.services.facebook.open_graph_namespace : 'joindiaspora'
"#{namespace}:frame"
end
......@@ -54,4 +54,4 @@ module OpenGraphHelper
"#{root_url.chop}#{image_path('asterisk.png')}"
end
end
end
\ No newline at end of file
end
......@@ -73,7 +73,7 @@ module PeopleHelper
# Rails.application.routes.url_helpers is needed since this is indirectly called from a model
def local_or_remote_person_path(person, opts={})
opts.merge!(:protocol => AppConfig[:pod_uri].scheme, :host => AppConfig[:pod_uri].authority)
opts.merge!(:protocol => AppConfig.pod_uri.scheme, :host => AppConfig.pod_uri.authority)
absolute = opts.delete(:absolute)
if person.local?
......
......@@ -20,7 +20,7 @@ module PostsHelper
def post_iframe_url(post_id, opts={})
opts[:width] ||= 516
opts[:height] ||= 315
host = AppConfig[:pod_uri].site
host = AppConfig.pod_uri.site
"<iframe src='#{Rails.application.routes.url_helpers.post_url(post_id, :host => host)}' width='#{opts[:width]}px' height='#{opts[:height]}px' frameBorder='0'></iframe>".html_safe
end
end
......@@ -9,7 +9,7 @@ module SessionsHelper
end
def display_registration_link?
!AppConfig[:registrations_closed] && devise_mapping.registerable? && controller_name != 'registrations'
!AppConfig.settings.enable_registrations? && devise_mapping.registerable? && controller_name != 'registrations'
end
def display_password_reset_link?
......
class DiasporaDeviseMailer < Devise::Mailer
default :from => AppConfig[:smtp_sender_address]
default :from => AppConfig.mail.sender_address
def self.mailer_name
"devise/mailer"
......
......@@ -9,7 +9,7 @@ module NotificationMailers
@comment = Comment.find_by_id(comment_id)
if mail?
@headers[:from] = "\"#{@comment.author_name} (Diaspora*)\" <#{AppConfig[:smtp_sender_address]}>"
@headers[:from] = "\"#{@comment.author_name} (Diaspora*)\" <#{AppConfig.mail.sender_address}>"
@headers[:subject] = truncate(@comment.comment_email_subject, :length => TRUNCATION_LEN)
@headers[:subject] = "Re: #{@headers[:subject]}"
end
......
......@@ -33,12 +33,12 @@ module NotificationMailers
private
def default_headers
headers = {
:from => AppConfig[:smtp_sender_address],
:host => "#{AppConfig[:pod_uri]}",
:from => AppConfig.mail.sender_address.get,
:host => "#{AppConfig.pod_uri.host}",
:to => name_and_address(@recipient.name, @recipient.email)
}
headers[:from] = "\"#{@sender.name} (Diaspora*)\" <#{AppConfig[:smtp_sender_address]}>" if @sender.present?
headers[:from] = "\"#{@sender.name} (Diaspora*)\" <#{AppConfig.mail.sender_address}>" if @sender.present?
headers
end
......
......@@ -7,7 +7,7 @@ module NotificationMailers
def set_headers(comment_id)
@comment = Comment.find(comment_id)
@headers[:from] = "\"#{@comment.author_name} (Diaspora*)\" <#{AppConfig[:smtp_sender_address]}>"
@headers[:from] = "\"#{@comment.author_name} (Diaspora*)\" <#{AppConfig.mail.sender_address}>"
@headers[:subject] = truncate(@comment.comment_email_subject, :length => TRUNCATION_LEN)
@headers[:subject] = "Re: #{@headers[:subject]}"
end
......
......@@ -7,7 +7,7 @@ module NotificationMailers
@conversation = @message.conversation
@participants = @conversation.participants
@headers[:from] = "\"#{@message.author_name} (Diaspora*)\" <#{AppConfig[:smtp_sender_address]}>"
@headers[:from] = "\"#{@message.author_name} (Diaspora*)\" <#{AppConfig.mail.sender_address}>"
@headers[:subject] = @conversation.subject.strip
@headers[:subject] = "Re: #{@headers[:subject]}" if @conversation.messages.size > 1
end
......
......@@ -24,8 +24,8 @@ class Notifier < ActionMailer::Base
end
default_opts = {:to => @receiver.email,
:from => AppConfig[:smtp_sender_address],
:subject => I18n.t('notifier.single_admin.subject'), :host => AppConfig[:pod_uri].host}
:from => AppConfig.mail.sender_address,
:subject => I18n.t('notifier.single_admin.subject'), :host => AppConfig.pod_uri.host}
default_opts.merge!(opts)
......@@ -42,9 +42,9 @@ class Notifier < ActionMailer::Base
@locale = locale
@invitation_code = invitation_code
mail_opts = {:to => email, :from => AppConfig[:smtp_sender_address],
:subject => I18n.t('notifier.invited_you', :name => @inviter.name),
:host => AppConfig[:pod_uri].host}
mail_opts = {:to => email, :from => AppConfig.mail.sender_address,
:subject => I18n.t('notifier.invited_you', :name => @inviter.name),
:host => AppConfig.pod_uri.host}
I18n.with_locale(locale) do
mail(mail_opts) do |format|
......
# Copyright (c) 2010-2011, Diaspora Inc. This file is
# licensed under the Affero General Public License version 3 or later. See
# the COPYRIGHT file.
require 'uri'
require Rails.root.join('lib', 'environment_configuration')
class AppConfig < Settingslogic
def self.source_file_name
if ENV['application_yml'].present?
puts "using remote application.yml"
return ENV['application_yml']
end
config_file = Rails.root.join("config", "application.yml")
if !File.exists?(config_file) && (Rails.env == 'test' || Rails.env.include?("integration") || EnvironmentConfiguration.heroku?)
config_file = Rails.root.join("config", "application.yml.example")
end
config_file
end
source source_file_name
namespace Rails.env
def self.load!
unless EnvironmentConfiguration.heroku?
if no_config_file? && !have_old_config_file?
$stderr.puts <<-HELP
******** You haven't set up your Diaspora settings file. **********
Please do the following:
1. Copy config/application.yml.example to config/application.yml.
2. Have a look at the settings in that file. It has sensible defaults for development, which (we hope)
work without modification. However, it's always good to know what's available to change later.
3. Restart Diaspora!
******** Thanks for being an alpha tester! **********
HELP
Process.exit(1)
end
if ((no_config_file? && have_old_config_file?) || config_file_is_old_style?)
$stderr.puts <<-HELP
******** The Diaspora configuration file format has changed. **********
Please do the following:
1. Copy config/application.yml.example to config/application.yml.
2. Make any changes in config/application.yml that you previously made in config/app.yml or config/app_config.yml.
3. Delete config/app.yml and config/app_config.yml. Don't worry if they don't exist, though.
4. Restart Diaspora!
******** Thanks for being an alpha tester! **********
HELP
Process.exit(1)
end
end
begin
super
rescue TypeError
puts "Couldn't find section ''#{self.namespace}' in config/application.yml."
puts "Double check it's there and that you haven't set RAILS_ENV to something weired (check it for typos)"
Process.exit(1)
end
if !EnvironmentConfiguration.heroku? && no_cert_file_in_prod?
$stderr.puts <<-HELP
******** Diaspora does not know where your SSL-CA-Certificates file is. **********
Please add the root certificate bundle (this is operating system specific) to application.yml. Defaults:
CentOS: '/etc/pki/tls/certs/ca-bundle.crt'
Debian: '/etc/ssl/certs/ca-certificates.crt'
Example:
ca_file: '/etc/ssl/certs/ca-certificates.crt'
******** Thanks for being secure! **********
HELP
Process.exit(1)
end
end
def self.setup!
normalize_pod_url
normalize_admins
normalize_pod_services
deprecate_hoptoad_api_key
self[:to_ary] = []
end
def self.configured_services
self['configured_services'] || []
end
def self.config_file_is_old_style?
!(File.read(@source) =~ /^defaults: &defaults/)
end
def self.no_config_file?
!File.exists?(@source)
end
def self.no_cert_file_in_prod?
(Rails.env == "production") && (self[:ca_file].blank? || !File.exists?(self[:ca_file]))
end
def self.have_old_config_file?
File.exists?(Rails.root.join("config", "app.yml")) || (File.exists?(Rails.root.join("config", "app_config.yml")))
end
def self.new_relic_app_name
self[:new_relic_app_name] || self[:pod_uri].host
end
def self.normalize_pod_url
unless self[:pod_url] =~ /^(https?:\/\/)/ # starts with http:// or https://
self[:pod_url] = "http://#{self[:pod_url]}"
end
unless self[:pod_url] =~ /\/$/ # ends with slash
self[:pod_url] = "#{self[:pod_url]}/"
end
end
def self.bare_pod_uri
self[:pod_uri].authority.gsub('www.', '')
end
def self.normalize_admins
self[:admins] ||= []
self[:admins].collect! { |username| username.downcase }
end
def self.normalize_pod_services
self['configured_services'] = []
if defined?(SERVICES)
SERVICES.keys.each do |service|
unless SERVICES[service].keys.any?{|service_key| SERVICES[service][service_key].blank?}
self['configured_services'] << service
end
end
end
end
def deprecate_hoptoad_api_key
if self[:hoptoad_api_key].present?
$stderr.puts "WARNING: Please change hoptoad_api_key to airbrake_api_key in your application.yml"
self[:airbrake_api_key] = self[:hoptoad_api_key]
end
end
load!
def self.[] (key)
return self.pod_uri if key == :pod_uri
super
end
def self.[]= (key, value)
super
if key.to_sym == :pod_url
@@pod_uri = nil
normalize_pod_url
end
end
cattr_accessor :pod_uri
def self.pod_uri
if @@pod_uri.nil?
begin
@@pod_uri = Addressable::URI.parse(self[:pod_url])
rescue
puts "WARNING: pod url " + self[:pod_url] + " is not a legal URI"
end
end
return @@pod_uri
end
def self.single_process_mode?
(ENV['SINGLE_PROCESS'] == "true" || ENV['SINGLE_PROCESS_MODE'] == "true" || self[:single_process_mode]) ? true : false
end
def self.get_redis_instance
if ENV["REDISTOGO_URL"].present?
puts "WARNING: using the REDISTOGO_URL environment variable is deprecated, please use REDIS_URL now."
ENV['REDIS_URL'] = ENV["REDISTOGO_URL"]
end
redis_options = {}
if ENV['REDIS_URL'].present?
redis_options = { :url => ENV['REDIS_URL'] }
elsif ENV['RAILS_ENV']== 'integration2'
redis_options = { :host => 'localhost', :port => 6380 }
elsif self[:redis_url].present?
puts "WARNING: You're redis_url doesn't start with redis://" unless self[:redis_url].start_with?("redis://")
redis_options = { :url => self[:redis_url] }
end
Redis.new(redis_options.merge(:thread_safe => true))
end
end
......@@ -30,14 +30,14 @@ class InvitationCode < ActiveRecord::Base
end
def self.default_inviter_or(user)
if AppConfig[:admin_account].present?
inviter = User.find_by_username(AppConfig[:admin_account])
if AppConfig.admins.account.present?
inviter = User.find_by_username(AppConfig.admins.account.get)
end
inviter ||= user
inviter
end
def set_default_invite_count
self.count = AppConfig[:invite_count] || 25
self.count = AppConfig['settings.invitations.count'] || 25
end
end
......@@ -9,7 +9,7 @@ module Jobs
def self.perform(sender_public_url)
require Rails.root.join('lib', 'pubsubhubbub')
atom_url = sender_public_url + '.atom'
Pubsubhubbub.new(AppConfig[:pubsub_server]).publish(atom_url)
Pubsubhubbub.new(AppConfig.environment.pubsub_server.get).publish(atom_url)
end
end
end
......@@ -99,8 +99,8 @@ class Photo < ActiveRecord::Base
def update_remote_path
unless self.unprocessed_image.url.match(/^https?:\/\//)
pod_url = AppConfig[:pod_url].dup
pod_url.chop! if AppConfig[:pod_url][-1,1] == '/'
pod_url = AppConfig.environment.url.get.dup
pod_url.chop! if pod_url[-1,1] == '/'
remote_path = "#{pod_url}#{self.unprocessed_image.url}"
else
remote_path = self.unprocessed_image.url
......
......@@ -185,8 +185,8 @@ class Profile < ActiveRecord::Base
end
def absolutify_local_url url
pod_url = AppConfig[:pod_url].dup
pod_url.chop! if AppConfig[:pod_url][-1,1] == '/'
pod_url = AppConfig.environment.url.get
pod_url.chop! if pod_url[-1,1] == '/'
"#{pod_url}#{url}"
end
end
......@@ -13,20 +13,4 @@ class Role < ActiveRecord::Base
def self.add_spotlight(person)
find_or_create_by_person_id_and_name(person.id, 'spotlight')
end
def self.load_admins
admins = AppConfig[:admins] || []
admins.each do |username|
u = User.find_by_username(username)
find_or_create_by_person_id_and_name(u.person.id, 'admin')
end
end
def self.load_spotlight
spotlighters = AppConfig[:community_spotlight] || []
spotlighters.each do |diaspora_handle|
person = Person.find_by_diaspora_handle(diaspora_handle)
find_or_create_by_person_id_and_name(person.id, 'spotlight')
end
end
end
......@@ -14,7 +14,7 @@ class Service < ActiveRecord::Base
def public_message(post, length, url = "")
Rails.logger.info("Posting out to #{self.class}")
url = Rails.application.routes.url_helpers.short_post_url(post, :protocol => AppConfig[:pod_uri].scheme, :host => AppConfig[:pod_uri].authority)
url = Rails.application.routes.url_helpers.short_post_url(post, :protocol => AppConfig.pod_uri.scheme, :host => AppConfig.pod_uri.authority)
space_for_url = 21 + 1
truncated = truncate(post.text(:plain_text => true), :length => (length - space_for_url))
truncated = "#{truncated} #{url}"
......
......@@ -23,7 +23,7 @@ class Services::Facebook < Service
end
def create_open_graph_params(post)
{:post => "#{AppConfig[:pod_url]}#{short_post_path(post)}", :access_token => self.access_token}
{:post => "#{AppConfig.environment.url}#{short_post_path(post)}", :access_token => self.access_token}
end
def create_post_params(post)
......@@ -38,4 +38,4 @@ class Services::Facebook < Service
def profile_photo_url
"https://graph.facebook.com/#{self.uid}/picture?type=large&access_token=#{URI.escape(self.access_token)}"
end
end
\ No newline at end of file
end
......@@ -9,11 +9,11 @@ class Services::Tumblr < Service
end
def consumer_key
SERVICES['tumblr']['consumer_key']
AppConfig.services.tumblr.key
end
def consumer_secret
SERVICES['tumblr']['consumer_secret']
AppConfig.services.tumblr.secret
end
def post(post, url='')
......
......@@ -35,8 +35,8 @@ class Services::Twitter < Service
private
def configure_twitter
twitter_key = SERVICES['twitter']['consumer_key']
twitter_consumer_secret = SERVICES['twitter']['consumer_secret']
twitter_key = AppConfig.services.twitter.key
twitter_consumer_secret = AppConfig.services.twitter.secret
if twitter_key.blank? || twitter_consumer_secret.blank?
Rails.logger.info "you have a blank twitter key or secret.... you should look into that"
......
......@@ -395,7 +395,7 @@ class User < ActiveRecord::Base
end
def set_person(person)
person.url = AppConfig[:pod_url]
person.url = AppConfig.environment.url
person.diaspora_handle = "#{self.username}#{User.diaspora_id_host}"
self.person = person
end
......@@ -410,7 +410,7 @@ class User < ActiveRecord::Base
self.aspects.create(:name => I18n.t('aspects.seed.work'))
aq = self.aspects.create(:name => I18n.t('aspects.seed.acquaintances'))
unless AppConfig[:no_follow_diasporahq]
unless AppConfig.settings.follow_diasporahq
default_account = Webfinger.new('diasporahq@joindiaspora.com').fetch
self.share_with(default_account, aq) if default_account
end
......
......@@ -15,7 +15,7 @@ class OEmbedPresenter
def as_json(opts={})
{
:provider_name => "Diaspora",
:provider_hurl => AppConfig[:pod_url],
:provider_url => AppConfig.environment.url,
:type => 'rich',