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

Defined in:
lib/utopia/command/setup.rb

Overview

Helpers for setting up the server deployment.

Constant Summary collapse

ROOT =

The root directory of the template server deployment:

File.join(BASE, 'server')

Class Method Summary collapse

Class Method Details

.environment(root) ⇒ Object

Setup config/environment.yaml according to specified options.



57
58
59
60
61
62
63
64
65
66
# File 'lib/utopia/command/setup.rb', line 57

def self.environment(root)
  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.



69
70
71
72
73
74
# File 'lib/utopia/command/setup.rb', line 69

def self.update_default_environment(root)
  environment(root) do |store|
    store['RACK_ENV'] ||= 'production'
    store['UTOPIA_SESSION_SECRET'] ||= SecureRandom.hex(40)
  end
end