Browse files

close #312, add email smtp secret settings.

  • Loading branch information...
1 parent 9b64d4b commit 48a40dafe583e7b9a76573cd6e4739629253dd04 @saberma committed Nov 26, 2011
View
1 .gitignore
@@ -7,6 +7,7 @@ config/sunspot.yml
config/unicorn.conf.rb
config/newrelic.yml
config/express.yml
+config/app_secret_config.yml
config/initializers/secret_token.rb
.bundle
View
2 app/mailers/theme_mailer.rb
@@ -1,6 +1,6 @@
# encoding: utf-8
class ThemeMailer < ActionMailer::Base
- default :from => "shopqi_test@163.com"
+ default from: SecretSetting.mail.from
def export(shop, name, tar_gz_content)
user = shop.users.where(admin: true).first
View
6 app/models/secret_setting.rb
@@ -0,0 +1,6 @@
+# 放置保密类配置信息
+class SecretSetting < Settingslogic
+ source "#{Rails.root}/config/app_secret_config.yml"
+ namespace Rails.env
+ load!
+end
View
1 app/models/setting.rb
@@ -1,6 +1,7 @@
class Setting < Settingslogic
source "#{Rails.root}/config/app_config.yml"
namespace Rails.env
+ load!
begin 'shopqi.com'
View
34 config/app_secret_config.yml.example
@@ -0,0 +1,34 @@
+defaults: &defaults
+ mail:
+ address: "smtp.163.com"
+ port: 25
+ domain: "example.com"
+ user_name: "noreply@example.com"
+ password: "666666"
+ from: "ShopQi电子商务平台 <noreply@example.com>"
+
+development:
+ <<: *defaults
+ mail:
+ address: "smtp.163.com"
+ port: 25
+ domain: "example.com"
+ user_name: "shopqi_test@163.com"
+ password: "666666"
+ from: "ShopQi电子商务平台 <shopqi_test@163.com>"
+
+test:
+ <<: *defaults
+
+travis:
+ <<: *defaults
+
+production:
+ <<: *defaults
+ mail:
+ address: "smtp.gmail.com"
+ port: 465
+ domain: "shopqi.com"
+ user_name: "noreply@shopqi.com"
+ password: ""
+ from: "ShopQi电子商务平台 <noreply@shopqi.com>"
View
4 config/deploy.rb
@@ -44,12 +44,12 @@
run "kill -s USR2 `cat /tmp/unicorn.#{application}.pid`"
end
- # scp -P $CAP_PORT config/{database,sms,alipay,admin_users,sunspot}.yml $CAP_USER@$CAP_APP_HOST:/u/apps/shopqi/shared/config/
+ # scp -P $CAP_PORT config/{database,sms,alipay,admin_users,sunspot,app_secret_config}.yml $CAP_USER@$CAP_APP_HOST:/u/apps/shopqi/shared/config/
# scp -P $CAP_PORT config/unicorn.conf.rb $CAP_USER@$CAP_APP_HOST:/u/apps/shopqi/shared/config/
# scp -P $CAP_PORT config/initializers/secret_token.rb $CAP_USER@$CAP_APP_HOST:/u/apps/shopqi/shared/config/initializers/
desc "Symlink shared resources on each release" # 配置文件
task :symlink_shared, roles: :app do
- %w(database.yml sms.yml alipay.yml admin_users.yml sunspot.yml unicorn.conf.rb).each do |secure_file|
+ %w(database.yml sms.yml alipay.yml admin_users.yml sunspot.yml app_secret_config.yml unicorn.conf.rb).each do |secure_file|
run "ln -nfs #{shared_path}/config/#{secure_file} #{release_path}/config/#{secure_file}"
end
run "ln -nfs #{shared_path}/config/initializers/secret_token.rb #{release_path}/config/initializers/secret_token.rb"
View
12 config/initializers/setup_mail.rb
@@ -1,9 +1,9 @@
ActionMailer::Base.smtp_settings = {
- :address => "smtp.163.com",
- :port => 25,
- :domain => "shopqi.com",
- :user_name => "shopqi_test@163.com",
- :password => "666666",
- :authentication => "plain",
+ :address => SecretSetting.mail.address,
+ :port => SecretSetting.mail.port,
+ :domain => SecretSetting.mail.domain,
+ :user_name => SecretSetting.mail.user_name,
+ :password => SecretSetting.mail.password,
+ :authentication => :plain,
:enable_starttls_auto => false
}

0 comments on commit 48a40da

Please sign in to comment.