put ldap setting into config file. should load be rails env. Also make god config more friendly.
This commit is contained in:
parent
8dd1ab32c1
commit
86a4a6cbe2
|
@ -1 +1,2 @@
|
|||
APP_CONFIG = YAML.load_file("#{Rails.root}/config/config.yml")[Rails.env]
|
||||
LDAP_CONFIG = YAML.load_file("#{Rails.root}/config/ldap.yml")[Rails.env]
|
|
@ -6,20 +6,11 @@ $nccu_ldap_connection
|
|||
module NccuLdapConnection
|
||||
BASE = 'ou=People,dc=nccu,dc=edu,dc=tw'
|
||||
|
||||
@ldap_host = {
|
||||
:host => '127.0.0.1', #140.119.166.23 or 127.0.0.1
|
||||
:port => 8001, #389 or 8001
|
||||
# :filter => "(uid=#{login_uid})",
|
||||
# :base => "ou=People,dc=nccu,dc=edu,dc=tw",
|
||||
:authenticate_info => "cn=uccn,ou=profile,dc=nccu,dc=edu,dc=tw",
|
||||
:authenticate_pwd => "nccu2ucc"
|
||||
}
|
||||
|
||||
def self.establish
|
||||
$nccu_ldap_connection = Net::LDAP.new
|
||||
$nccu_ldap_connection.port = @ldap_host[:port]
|
||||
$nccu_ldap_connection.host = @ldap_host[:host]
|
||||
$nccu_ldap_connection.authenticate(@ldap_host[:authenticate_info],@ldap_host[:authenticate_pwd])
|
||||
$nccu_ldap_connection.port =LDAP_CONFIG["port"]
|
||||
$nccu_ldap_connection.host = LDAP_CONFIG["host"]
|
||||
$nccu_ldap_connection.authenticate(LDAP_CONFIG["authenticate_info"],LDAP_CONFIG["authenticate_pwd"])
|
||||
end
|
||||
|
||||
end
|
|
@ -0,0 +1,12 @@
|
|||
defaults: &defaults
|
||||
authenticate_info: 'cn=uccn,ou=profile,dc=nccu,dc=edu,dc=tw'
|
||||
authenticate_pwd: 'nccu2ucc'
|
||||
|
||||
development:
|
||||
<<: *defaults
|
||||
host: '127.0.0.1'
|
||||
port: 8001
|
||||
production:
|
||||
<<: *defaults
|
||||
host: '140.119.166.23'
|
||||
port: 389
|
|
@ -1,7 +1,14 @@
|
|||
#developer pls change here
|
||||
default_uid = 'kaito'
|
||||
default_gid = 'staff'
|
||||
|
||||
rails_env = 'development' #ENV['RAILS_ENV'] || "production"
|
||||
rails_root = ENV['RAILS_ROOT'] || "/Users/kaito/Documents/MyWorkspeace/NCCU"
|
||||
|
||||
|
||||
rails_root = ENV['RAILS_ROOT'] || File.expand_path("..",File.dirname(__FILE__))
|
||||
num_workers = rails_env == 'production' ? 5 : 2
|
||||
|
||||
|
||||
num_workers.times do |num|
|
||||
God.watch do |w|
|
||||
w.dir = "#{rails_root}"
|
||||
|
@ -12,8 +19,11 @@ num_workers.times do |num|
|
|||
# w.env = {"QUEUE"=>"critical,high,low", "RAILS_ENV"=>rails_env}
|
||||
w.start = "rake -f #{rails_root}/Rakefile resque:work QUEUE=* RAILS_ENV=#{rails_env}"
|
||||
|
||||
w.uid = 'kaito'
|
||||
w.gid = 'staff'
|
||||
w.uid = rails_env == 'production' ? nccu : default_uid
|
||||
w.gid = rails_env == 'production' ? nccu : default_gid
|
||||
|
||||
|
||||
w.log = "#{rails_root}/log/god.log"
|
||||
|
||||
# restart if memory gets too high
|
||||
w.transition(:up, :restart) do |on|
|
||||
|
|
Loading…
Reference in New Issue