Skip to content

Commit

Permalink
Configuration has a mount_at property which allows an application spe…
Browse files Browse the repository at this point in the history
…cify a mount point for its routes
  • Loading branch information
lucasas committed Aug 12, 2014
1 parent 41d1fe8 commit 2b18990
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 0 deletions.
37 changes: 37 additions & 0 deletions lib/lotus/configuration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -708,6 +708,43 @@ def scheme(value = nil)
end
end

# Application route point mount.
#
# Specify a point mount for the application, by passing a String.
#
# By default it's an empty String.
#
# @since x.x.x
#
# @example Getting the value
# require 'lotus'
#
# module Bookshelf
# class Application < Lotus::Application
# end
# end
#
# Bookshelf::Application.configuration.mount_at
# # => nil
#
# @example Setting the value, by passing a block
# require 'lotus'
#
# module Bookshelf
# class Application < Lotus::Application
# configure do
# mount_at 'backend'
# end
# end
# end
#
# Bookshelf::Application.configuration.mount_at
# # => backend
def mount_at(mount_at = '')
@mount_at = mount_at unless mount_at.empty?
@mount_at
end

# The URI host for this application.
# This is used by the router helpers to generate absolute URLs.
#
Expand Down
1 change: 1 addition & 0 deletions lib/lotus/loader.rb
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ def load_rack!
scheme: configuration.scheme,
host: configuration.host,
port: configuration.port,
mount_at: configuration.mount_at,
&configuration.routes
)

Expand Down

0 comments on commit 2b18990

Please sign in to comment.