summaryrefslogtreecommitdiff
path: root/lib/environment.rb
blob: 793fef9c629e5469b3a8dabbec6416e4c38a190d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
# load configuration

ENV['RACK_ENV'] = 'development' unless ENV['RACK_ENV']

config_file = File.join(ENV['HOME'], ".opentox/config/#{ENV['RACK_ENV']}.yaml")
if File.exist?(config_file)
	@@config = YAML.load_file(config_file)
else
	FileUtils.mkdir_p File.dirname(config_file)
	FileUtils.cp(File.join(File.dirname(__FILE__), 'templates/config.yaml'), config_file)
	puts "Please edit #{config_file} and restart your application."
	exit
end