Last active
January 14, 2016 11:30
-
-
Save daneb/49aaa21101d5a2ecade5 to your computer and use it in GitHub Desktop.
Lotus Migration Creation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'lotus/helpers' | |
module Authtracker | |
class Application < Lotus::Application | |
configure do | |
## | |
# BASIC | |
# | |
# Define the root path of this application. | |
# All paths specified in this configuration are relative to path below. | |
# | |
root __dir__ | |
# Relative load paths where this application will recursively load the code. | |
# When you add new directories, remember to add them here. | |
# | |
load_paths << [ | |
'controllers', | |
'views' | |
] | |
# Handle exceptions with HTTP statuses (true) or don't catch them (false). | |
# Defaults to true. | |
# See: http://www.rubydoc.info/gems/lotus-controller/#Exceptions_management | |
# | |
# handle_exceptions true | |
## | |
# HTTP | |
# | |
# Routes definitions for this application | |
# See: http://www.rubydoc.info/gems/lotus-router#Usage | |
# | |
routes 'config/routes' | |
# URI scheme used by the routing system to generate absolute URLs | |
# Defaults to "http" | |
# | |
# scheme 'https' | |
# URI host used by the routing system to generate absolute URLs | |
# Defaults to "localhost" | |
# | |
# host 'example.org' | |
# URI port used by the routing system to generate absolute URLs | |
# Argument: An object coercible to integer, default to 80 if the scheme is http and 443 if it's https | |
# This SHOULD be configured only in case the application listens to that non standard ports | |
# | |
# port 443 | |
# Enable cookies | |
# Argument: boolean to toggle the feature | |
# A Hash with options | |
# | |
# Options: :domain - The domain (String - nil by default, not required) | |
# :path - Restrict cookies to a relative URI (String - nil by default) | |
# :max_age - Cookies expiration expressed in seconds (Integer - nil by default) | |
# :secure - Restrict cookies to secure connections | |
# (Boolean - Automatically set on true if currenlty using a secure connection) | |
# See #scheme and #ssl? | |
# :httponly - Prevent JavaScript access (Boolean - true by default) | |
# | |
# cookies true | |
# or | |
# cookies max_age: 300 | |
# Enable sessions | |
# Argument: Symbol the Rack session adapter | |
# A Hash with options | |
# | |
# See: http://www.rubydoc.info/gems/rack/Rack/Session/Cookie | |
# | |
# sessions :cookie, secret: ENV['AUTHTRACKER_SESSIONS_SECRET'] | |
# Configure Rack middleware for this application | |
# | |
# middleware.use Rack::Protection | |
# Default format for the requests that don't specify an HTTP_ACCEPT header | |
# Argument: A symbol representation of a mime type, default to :html | |
# | |
# default_request_format :html | |
# Default format for responses that doesn't take into account the request format | |
# Argument: A symbol representation of a mime type, default to :html | |
# | |
# default_response_format :html | |
# HTTP Body parsers | |
# Parse non GET responses body for a specific mime type | |
# Argument: Symbol, which represent the format of the mime type (only `:json` is supported) | |
# Object, the parser | |
# | |
# body_parsers :json | |
# When it's true and the router receives a non-encrypted request (http), | |
# it redirects to the secure equivalent resource (https). Default disabled. | |
# | |
# force_ssl true | |
## | |
# TEMPLATES | |
# | |
# The layout to be used by all views | |
# | |
layout :application # It will load Authtracker::Views::ApplicationLayout | |
# The relative path to templates | |
# | |
templates 'templates' | |
## | |
# ASSETS | |
# | |
# Specify sources for assets | |
# The directory `public/` is added by default | |
# | |
# assets << [ | |
# 'vendor/javascripts' | |
# ] | |
# Enabling serving assets | |
# Defaults to false | |
# | |
# serve_assets false | |
## | |
# SECURITY | |
# | |
# X-Frame-Options is a HTTP header supported by modern browsers. | |
# It determines if a web page can or cannot be included via <frame> and | |
# <iframe> tags by untrusted domains. | |
# | |
# Web applications can send this header to prevent Clickjacking attacks. | |
# | |
# Read more at: | |
# | |
# * https://developer.mozilla.org/en-US/docs/Web/HTTP/X-Frame-Options | |
# * https://www.owasp.org/index.php/Clickjacking | |
# | |
security.x_frame_options "DENY" | |
# Content-Security-Policy (CSP) is a HTTP header supported by modern browsers. | |
# It determines trusted sources of execution for dynamic contents | |
# (JavaScript) or other web related assets: stylesheets, images, fonts, | |
# plugins, etc. | |
# | |
# Web applications can send this header to mitigate Cross Site Scripting | |
# (XSS) attacks. | |
# | |
# The default value allows images, scripts, AJAX, fonts and CSS from the same | |
# origin, and does not allow any other resources to load (eg object, | |
# frame, media, etc). | |
# | |
# Inline JavaScript is NOT allowed. To enable it, please use: | |
# "script-src 'unsafe-inline'". | |
# | |
# Content Security Policy introduction: | |
# | |
# * http://www.html5rocks.com/en/tutorials/security/content-security-policy/ | |
# * https://www.owasp.org/index.php/Content_Security_Policy | |
# * https://www.owasp.org/index.php/Cross-site_Scripting_%28XSS%29 | |
# | |
# Inline and eval JavaScript risks: | |
# | |
# * http://www.html5rocks.com/en/tutorials/security/content-security-policy/#inline-code-considered-harmful | |
# * http://www.html5rocks.com/en/tutorials/security/content-security-policy/#eval-too | |
# | |
# Content Security Policy usage: | |
# | |
# * http://content-security-policy.com/ | |
# * https://developer.mozilla.org/en-US/docs/Web/Security/CSP/Using_Content_Security_Policy | |
# | |
security.content_security_policy "default-src 'none'; script-src 'self'; connect-src 'self'; img-src 'self'; style-src 'self'; font-src 'self';" | |
## | |
# FRAMEWORKS | |
# | |
# Configure the code that will yield each time Authtracker::Action is included | |
# This is useful for sharing common functionality | |
# | |
# See: http://www.rubydoc.info/gems/lotus-controller#Configuration | |
controller.prepare do | |
# include MyAuthentication # included in all the actions | |
# before :authenticate! # run an authentication before callback | |
end | |
# Configure the code that will yield each time Authtracker::View is included | |
# This is useful for sharing common functionality | |
# | |
# See: http://www.rubydoc.info/gems/lotus-view#Configuration | |
view.prepare do | |
include Lotus::Helpers | |
end | |
end | |
## | |
# DEVELOPMENT | |
# | |
configure :development do | |
# Don't handle exceptions, render the stack trace | |
handle_exceptions false | |
# Serve static assets during development | |
serve_assets true | |
end | |
## | |
# TEST | |
# | |
configure :test do | |
# Don't handle exceptions, render the stack trace | |
handle_exceptions false | |
# Serve static assets during development | |
serve_assets true | |
end | |
## | |
# PRODUCTION | |
# | |
configure :production do | |
# scheme 'https' | |
# host 'example.org' | |
# port 443 | |
end | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
➜ shopping_cart_service git:(db_session) ✗ bundle exec lotus generate migration create_authtrackers | |
/Users/X/Documents/Github/Hetzner/shopping-cart-service/prototype/shopping_cart_service/apps/authtracker/application.rb:3:in `<top (required)>': Authtracker is not a module (TypeError) | |
from /Users/X/Documents/Github/Hetzner/shopping-cart-service/prototype/shopping_cart_service/config/environment.rb:5:in `require_relative' | |
from /Users/X/Documents/Github/Hetzner/shopping-cart-service/prototype/shopping_cart_service/config/environment.rb:5:in `<top (required)>' | |
from /Users/X/.rvm/gems/ruby-2.3.0-preview2/gems/lotusrb-0.6.0/lib/lotus/environment.rb:364:in `require' | |
from /Users/X/.rvm/gems/ruby-2.3.0-preview2/gems/lotusrb-0.6.0/lib/lotus/environment.rb:364:in `require_application_environment' | |
from /Users/X/.rvm/gems/ruby-2.3.0-preview2/gems/lotusrb-0.6.0/lib/lotus/commands/generate/migration.rb:30:in `initialize' | |
from /Users/X/.rvm/gems/ruby-2.3.0-preview2/gems/lotusrb-0.6.0/lib/lotus/cli_sub_commands/generate.rb:64:in `new' | |
from /Users/X/.rvm/gems/ruby-2.3.0-preview2/gems/lotusrb-0.6.0/lib/lotus/cli_sub_commands/generate.rb:64:in `migration' | |
from /Users/X/.rvm/gems/ruby-2.3.0-preview2/gems/thor-0.19.1/lib/thor/command.rb:27:in `run' | |
from /Users/X/.rvm/gems/ruby-2.3.0-preview2/gems/thor-0.19.1/lib/thor/invocation.rb:126:in `invoke_command' | |
from /Users/X/.rvm/gems/ruby-2.3.0-preview2/gems/thor-0.19.1/lib/thor.rb:359:in `dispatch' | |
from /Users/X/.rvm/gems/ruby-2.3.0-preview2/gems/thor-0.19.1/lib/thor/invocation.rb:115:in `invoke' | |
from /Users/X/.rvm/gems/ruby-2.3.0-preview2/gems/thor-0.19.1/lib/thor.rb:235:in `block in subcommand' | |
from /Users/X/.rvm/gems/ruby-2.3.0-preview2/gems/thor-0.19.1/lib/thor/command.rb:27:in `run' | |
from /Users/X/.rvm/gems/ruby-2.3.0-preview2/gems/thor-0.19.1/lib/thor/invocation.rb:126:in `invoke_command' | |
from /Users/X/.rvm/gems/ruby-2.3.0-preview2/gems/thor-0.19.1/lib/thor.rb:359:in `dispatch' | |
from /Users/X/.rvm/gems/ruby-2.3.0-preview2/gems/thor-0.19.1/lib/thor/base.rb:440:in `start' | |
from /Users/X/.rvm/gems/ruby-2.3.0-preview2/gems/lotusrb-0.6.0/bin/lotus:5:in `<top (required)>' | |
from /Users/X/.rvm/gems/ruby-2.3.0-preview2/bin/lotus:23:in `load' | |
from /Users/X/.rvm/gems/ruby-2.3.0-preview2/bin/lotus:23:in `<main>' | |
from /Users/X/.rvm/gems/ruby-2.3.0-preview2/bin/ruby_executable_hooks:15:in `eval' | |
from /Users/X/.rvm/gems/ruby-2.3.0-preview2/bin/ruby_executable_hooks:15:in `<main>' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment