Sha256: 3f8ea03b3d7e8718736552e9daec2f88b31485429d811dc3a5594b681324bd5b

Contents?: true

Size: 1.45 KB

Versions: 12

Compression:

Stored size: 1.45 KB

Contents

#!/usr/bin/env rackup

# Setup default encoding:
Encoding.default_external = Encoding::UTF_8
Encoding.default_internal = Encoding::UTF_8

# Setup the server environment:
RACK_ENV = ENV.fetch('RACK_ENV', :development).to_sym unless defined?(RACK_ENV)

# Allow loading library code from lib directory:
$LOAD_PATH << File.expand_path("lib", __dir__)

require 'utopia'
require 'rack/cache'

if RACK_ENV == :production
	use Utopia::ExceptionHandler, "/errors/exception"
	use Utopia::MailExceptions
elsif RACK_ENV == :development
	use Rack::ShowExceptions
end

use Rack::Sendfile

if RACK_ENV == :production
	use Rack::Cache,
		metastore: "file:#{Utopia::default_root("cache/meta")}",
		entitystore: "file:#{Utopia::default_root("cache/body")}",
		verbose: RACK_ENV == :development
end

use Rack::ContentLength

use Utopia::Redirector,
	patterns: [
		Utopia::Redirector::DIRECTORY_INDEX
	],
	strings: {
		'/' => '/welcome/index',
	},
	errors: {
		404 => "/errors/file-not-found"
	}

use Utopia::Localization,
	:default_locale => 'en',
	:locales => ['en', 'de', 'ja', 'zh'],
	:nonlocalized => ['/_static/', '/_cache/']

use Utopia::Controller,
	cache_controllers: (RACK_ENV == :production)

use Utopia::Static

use Utopia::Content,
	cache_templates: (RACK_ENV == :production),
	tags: {
		'deferred' => Utopia::Tags::Deferred,
		'override' => Utopia::Tags::Override,
		'node' => Utopia::Tags::Node,
		'environment' => Utopia::Tags::Environment.for(RACK_ENV)
	}

run lambda { |env| [404, {}, []] }

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
utopia-1.3.2 setup/site/config.ru
utopia-1.3.1 setup/site/config.ru
utopia-1.3.0 setup/site/config.ru
utopia-1.2.4 setup/site/config.ru
utopia-1.2.3 setup/site/config.ru
utopia-1.2.2 setup/site/config.ru
utopia-1.2.1 setup/site/config.ru
utopia-1.2.0 setup/site/config.ru
utopia-1.1.4 setup/site/config.ru
utopia-1.1.2 setup/site/config.ru
utopia-1.1.1 setup/site/config.ru
utopia-1.1.0 setup/site/config.ru