Module: Utopia::Command::Setup::Server

Defined in:
lib/utopia/command.rb

Constant Summary collapse

ROOT =
File.join(BASE, 'server')

Class Method Summary collapse

Class Method Details

.environment(root) ⇒ Object



51
52
53
54
55
56
57
58
59
60
61
# File 'lib/utopia/command.rb', line 51

def self.environment(root)
	# Setup config/environment.yaml according to specified options:
	environment_path = File.join(root, 'config/environment.yaml')
	FileUtils.mkpath File.dirname(environment_path)
	
	store = YAML::Store.new(environment_path)
	
	store.transaction do
		yield store
	end
end

.update_default_environment(root) ⇒ Object

Set some useful defaults for the environment:



64
65
66
67
68
69
70
# File 'lib/utopia/command.rb', line 64

def self.update_default_environment(root)
	# Set up some useful defaults for server environment:
	environment(root) do |store|
		store['RACK_ENV'] ||= 'production'
		store['UTOPIA_SESSION_SECRET'] ||= SecureRandom.hex(40)
	end
end