Skip to content

Commit 39cb034

Browse files
committed
Load the config file from /mnt/app/current/config/... instead of /etc/ec2onrails. Also renamed method.
1 parent f8aa36f commit 39cb034

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

server/files/usr/local/ec2onrails/lib/roles_helper.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ def process_config_file_templates
137137
# Set any variables that will be needed inside the templates
138138
# We're processing ALL templates, even ones that won't be used in the current role.
139139
rails_env = Ec2onrails::Utils.rails_env
140-
config = Ec2onrails::Utils.load_config
140+
config = Ec2onrails::Utils.load_ec2onrails_config
141141
roles = self.roles
142142

143143
Dir["/etc/**/*.erb"].each do |template|

server/files/usr/local/ec2onrails/lib/utils.rb

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,13 @@ def self.hostname
1313
`hostname -s`.strip
1414
end
1515

16-
def self.load_config
17-
config = {}
18-
begin
19-
config = eval(File.read("/etc/ec2onrails/config.rb"))
20-
rescue Exception => e
21-
puts "ERROR:\n#{e.inspect}\n#{e.backtrace.join("\n")}"
16+
def self.load_ec2onrails_config
17+
config_file = "/mnt/app/current/config/ec2onrails/config.rb"
18+
if File.exists?(config_file)
19+
config = eval(File.read(config_file))
20+
else
21+
puts "#{config_file} doesn't exist"
22+
config = {}
2223
end
2324
return config
2425
end

0 commit comments

Comments
 (0)