Skip to content
Extraits de code Groupes Projets
Valider 020ff603 rédigé par ilya's avatar ilya
Parcourir les fichiers

terse_url in user, db seeds are fixed, config/app_config.yml is now in...

terse_url in user, db seeds are fixed, config/app_config.yml is now in gitignore, copy over config/app_config_example.yml.
parent c8e52526
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
...@@ -13,3 +13,4 @@ gpg/diaspora-production/*.gpg ...@@ -13,3 +13,4 @@ gpg/diaspora-production/*.gpg
gpg/*/random_seed gpg/*/random_seed
public/uploads/* public/uploads/*
.rvmrc .rvmrc
config/app_config.yml
...@@ -221,6 +221,9 @@ class User ...@@ -221,6 +221,9 @@ class User
###Helpers############ ###Helpers############
def self.instantiate!( opts = {} ) def self.instantiate!( opts = {} )
terse_url = APP_CONFIG[:pod_url].gsub(/(https?:|www\.)\/\//, '')
terse_url.chop! if terse_url[-1, 1] == '/'
opts[:person][:diaspora_handle] = "#{opts[:username]}@#{terse_url}" opts[:person][:diaspora_handle] = "#{opts[:username]}@#{terse_url}"
opts[:person][:url] = APP_CONFIG[:pod_url] opts[:person][:url] = APP_CONFIG[:pod_url]
opts[:person][:serialized_key] = generate_key opts[:person][:serialized_key] = generate_key
......
# Copyright (c) 2010, Diaspora Inc. This file is ---
# licensed under the Affero General Public License version 3. See default:
# the COPYRIGHT file.
default:
pod_url: "http://example.org/"
debug: false
socket_debug : false
socket_host: 0.0.0.0 socket_host: 0.0.0.0
socket_port: 8080 socket_debug: false
socket_collection_name: 'websocket' pod_url: tom.joindiaspora.com
pubsub_server: 'https://pubsubhubbub.appspot.com/'
mongo_host: 'localhost'
mongo_post: 27017 mongo_post: 27017
socket_collection_name: websocket
development: socket_port: 8080
pubsub_server: https://pubsubhubbub.appspot.com/
test: mongo_host: localhost
pod_url: "http://example.org/" debug: false
production:
development:
pod_url: tom.joindiaspora.com
test:
pod_url: http://example.org/
socket_port: 8081 socket_port: 8081
production:
# Copyright (c) 2010, Diaspora Inc. This file is
# licensed under the Affero General Public License version 3. See
# the COPYRIGHT file.
default:
pod_url: "http://example.org/"
debug: false
socket_debug : false
socket_host: 0.0.0.0
socket_port: 8080
socket_collection_name: 'websocket'
pubsub_server: 'https://pubsubhubbub.appspot.com/'
mongo_host: 'localhost'
mongo_post: 27017
development:
test:
pod_url: "http://example.org/"
socket_port: 8081
production:
...@@ -42,10 +42,10 @@ def create ...@@ -42,10 +42,10 @@ def create
end end
def set_app_config username def set_app_config username
current_config = YAML.load(Rails.root.join('config', 'app_config.yml')).symbolize_keys current_config = YAML.load(File.read(Rails.root.join('config', 'app_config_example.yml')))
current_config[Rails.env] ||= {} current_config[Rails.env.to_s] ||= {}
current_config[Rails.env][:pod_url] = "#{username}.joindiaspora.com" current_config[Rails.env.to_s]['pod_url'] = "#{username}.joindiaspora.com"
current_config[:default][:pod_url] = "#{username}.joindiaspora.com" current_config['default']['pod_url'] = "#{username}.joindiaspora.com"
file = File.new(Rails.root.join('config','app_config.yml'),'w') file = File.new(Rails.root.join('config','app_config.yml'),'w')
file.write(current_config.to_yaml) file.write(current_config.to_yaml)
file.close file.close
......
...@@ -6,7 +6,19 @@ ...@@ -6,7 +6,19 @@
require 'config/environment' require 'config/environment'
def set_app_config username
current_config = YAML.load(File.read(Rails.root.join('config', 'app_config_example.yml')))
current_config[Rails.env.to_s] ||= {}
current_config[Rails.env.to_s]['pod_url'] = "#{username}.joindiaspora.com"
current_config['default']['pod_url'] = "#{username}.joindiaspora.com"
file = File.new(Rails.root.join('config','app_config.yml'),'w')
file.write(current_config.to_yaml)
file.close
end
username = "tom" username = "tom"
set_app_config username
# Create seed user # Create seed user
user = User.instantiate!( :email => "tom@tom.joindiaspora.com", user = User.instantiate!( :email => "tom@tom.joindiaspora.com",
:username => "tom", :username => "tom",
......
...@@ -7,10 +7,10 @@ ...@@ -7,10 +7,10 @@
require 'config/environment' require 'config/environment'
def set_app_config username def set_app_config username
current_config = YAML.load(Rails.root.join('config', 'app_config.yml')).symbolize_keys current_config = YAML.load(File.read(Rails.root.join('config', 'app_config_example.yml')))
current_config[Rails.env] ||= {} current_config[Rails.env.to_s] ||= {}
current_config[Rails.env][:pod_url] = "#{username}.joindiaspora.com" current_config[Rails.env.to_s]['pod_url'] = "#{username}.joindiaspora.com"
current_config[:default][:pod_url] = "#{username}.joindiaspora.com" current_config['default']['pod_url'] = "#{username}.joindiaspora.com"
file = File.new(Rails.root.join('config','app_config.yml'),'w') file = File.new(Rails.root.join('config','app_config.yml'),'w')
file.write(current_config.to_yaml) file.write(current_config.to_yaml)
file.close file.close
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter