Method: Staticd::App#initialize

Defined in:
lib/staticd/app.rb

#initialize(config) ⇒ App

Initialize the Staticd app.

General configuration:

  • environment: the app environment (test, development or production)

  • domain: base to generate per app sub-domain

  • public_port: port used to generate application and endpoint url, (default to 80)

  • database: database url to store resources metadata

  • datastore: datastore url to store resources

  • host: host to listen to

  • port: port to listen to

API service configuration:

  • api: enable the API service

  • access_id: HMAC authentication access ID for the API service

  • secret_key: HMAC authentication secret key for the API service

HTTP service configuration:

  • http: enable the HTTP service

  • http_cache: folder where resources are cached



42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/staticd/app.rb', line 42

def initialize(config)
  @config = config
  @config[:public_port] ||= "80"
  require_settings(:environment, :domain, :database, :datastore)

  env = @config[:environment]
  puts "Starting Staticd in #{env} environment." unless env == "test"
  display_current_config if env == "development"

  init_database
  init_datastore
end