Settings disponibles/Available Settings

  1. absolute_redirects If disabled, Sinatra will allow relative redirects, however, Sinatra will no longer conform with RFC 2616 (HTTP 1.1), which only allows absolute redirects.

    Enable if your app is running behind a reverse proxy that has not been set up properly. Note that the url helper will still produce absolute URLs, unless you pass in false as the second parameter. Disabled by default.

  2. add_charsets mime types the content_type helper will automatically add the charset info to.

    You should add to it rather than overriding this option:

    settings.add_charsets << "application/foobar"
    
  3. app_file Path to the main application file, used to detect project root, views and public folder and inline templates.
  4. bind IP address to bind to (default: 0.0.0.0 or localhost if your environment is set to development). Only used for built-in server.
  5. default_encoding encoding to assume if unknown (defaults to "utf-8").
  6. dump_errors display errors in the log.
  7. environment current environment, defaults to ENV['RACK_ENV'], or development if not available.
  8. logging use the logger.
  9. lock Places a lock around every request, only running processing on request per Ruby process concurrently. Enabled if your app is not thread-safe. Disabled per default.
  10. method_override use _method magic to allow put/delete forms in browsers that don't support it.
  11. port Port to listen on. Only used for built-in server.
  12. prefixed_redirects Whether or not to insert request.script_name into redirects if no absolute path is given. That way redirect '/foo' would behave like redirect to('/foo'). Disabled per default.
  13. protection Whether or not to enable web attack protections. See protection section above.
  14. public_dir Alias for public_folder. See below.
  15. public_folder Path to the folder public files are served from. Only used if static file serving is enabled (see static setting below). Inferred from app_file setting if not set.
  16. reload_templates Whether or not to reload templates between requests. Enabled in development mode.
  17. root Path to project root folder. Inferred from app_file setting if not set.
  18. raise_errors raise exceptions (will stop application). Enabled by default when environment is set to "test", disabled otherwise.
  19. run if enabled, Sinatra will handle starting the web server, do not enable if using rackup or other means.
  20. running is the built-in server running now? do not change this setting!
  21. server Server or list of servers to use for built-in server. order indicates priority, default depends on Ruby implementation.
  22. sessions Enable cookie-based sessions support using Rack::Session::Cookie. See 'Using Sessions' section for more information.
  23. show_exceptions Show a stack trace in the browser when an exception happens. Enabled by default when environment is set to "development", disabled otherwise. Can also be set to :after_handler to trigger app-specified error handling before showing a stack trace in the browser.
  24. static Whether Sinatra should handle serving static files. Disable when using a server able to do this on its own. Disabling will boost performance. Enabled per default in classic style, disabled for modular apps.
  25. static_cache_control When Sinatra is serving static files, set this to add Cache-Control headers to the responses. Uses the cache_control helper. Disabled by default. Use an explicit array when setting multiple values:
    set :static_cache_control, [:public, :max_age => 300]
    
  26. threaded If set to true, will tell Thin to use EventMachine.defer for processing the request.
  27. views Path to the views folder. Inferred from app_file setting if not set.
  28. x_cascade Whether or not to set the X-Cascade header if no route matches. Defaults to true.

Casiano Rodriguez León 2015-01-07