调整ENV参数细节

This commit is contained in:
yafeilee 2014-04-01 17:09:35 +08:00
parent 2ec5f8e82a
commit 68eebb8989
7 changed files with 20 additions and 13 deletions

View File

@ -5,7 +5,7 @@ class Admin::SessionsController < ApplicationController
end
def create
if ! ENV['ADMIN_USER']
if ENV['ADMIN_USER'].blank?
render :json=> { success: false, message: '系统未配置管理员账户, 无法登录' }
elsif ENV['ADMIN_USER'] != params[:username]
render :json=> { success: false, message: '管理员账户错误' }

View File

@ -1,5 +1,6 @@
# encoding : utf-8
class BlogsController < ApplicationController
def index
@newest = Post.desc(:created_at).first
@recent = Post.desc(:created_at).to_a[1..5]

View File

@ -23,7 +23,7 @@ class Post
validates :type, :presence=>true, :inclusion => { :in => [ TECH, LIFE, CREATOR ] }
after_create do
unless ENV['SENDCLOUD_USER']
if ENV['SENDCLOUD_USER'].present?
NewPostWorker.perform_async(self.title, Subscribe.subscribe_list)
end
end

View File

@ -30,11 +30,12 @@
p = link_to '关于我', about_path
h4 SUBSCRIBE
ul.subscribe-ul
li
= link_to '邮件订阅 ', '', "ng-click"=>"click('email')"
p
.email-subscribe ng-show="type == 'email'"
= text_field_tag 'email', nil, placeholder: 'your@email.com'
- if ENV['SENDCLOUD_USER'].present?
li
= link_to '邮件订阅 ', '', "ng-click"=>"click('email')"
p
.email-subscribe ng-show="type == 'email'"
= text_field_tag 'email', nil, placeholder: 'your@email.com'
li
= link_to '微信扫一扫', '', "ng-click"=>"click('weixin')"
p

View File

@ -1,4 +1,4 @@
- if ENV['GOOGLE']
- if ENV['GOOGLE'].present?
javascript:
var _gaq = _gaq || [];
_gaq.push(['_setAccount', '#{ENV['GOOGLE']}']);

View File

@ -2,7 +2,6 @@ require File.expand_path('../boot', __FILE__)
# Pick the frameworks you want:
require "active_model/railtie"
# require "active_record/railtie"
require "action_controller/railtie"
require "action_mailer/railtie"
require "action_view/railtie"

View File

@ -1,11 +1,17 @@
# Add application configuration variables here, as shown below.
#
# 必须配置的
SITE_NAME: "WinDy's Blog"
# 后台登录的用户名与密码, 不填的话无法管理后台
ADMIN_USER: 'admin'
ADMIN_PASSWORD: 'admin'
# 可选的
# google analytics, 如果不需要可以留空
GOOGLE: 'UA-32883596-1'
# SENDCLOUD 邮件订阅功能, 留空用户名表示不需要创建博客后发送订阅邮件
# 更多参数细节请查阅: /app/workers/new_post_worker.rb
SENDCLOUD_USER: ''
SENDCLOUD_PASSWORD: ''
SENDCLOUD_FROM: ''
SENDCLOUD_FROMNAME: ''
SENDCLOUD_SITE_ADDRESS: ''