Skip to content

Commit

Permalink
Fixed marklogic-community#466: replaced app-name-rest-modules with re…
Browse files Browse the repository at this point in the history
…st-modules-db prop
  • Loading branch information
grtjn committed Jan 28, 2016
1 parent f597a78 commit 260fcdf
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 6 deletions.
13 changes: 7 additions & 6 deletions deploy/lib/server_config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1534,7 +1534,7 @@ def deploy_rest
# Figure out where we need to deploy this stuff
rest_modules_db = ''
if @properties.has_key?('ml.rest-port') and @properties['ml.rest-port'] != ''
rest_modules_db = "#{@properties['ml.app-name-rest-modules']}"
rest_modules_db = conditional_prop('ml.rest-modules-db', 'ml.modules-db')
else
rest_modules_db = @properties['ml.modules-db']
end
Expand Down Expand Up @@ -2103,6 +2103,7 @@ def build_config(config_file)
if @properties['ml.rest-port'].present?
# Set up a REST API app server, distinct from the main application.

rest_modules_db = conditional_prop('ml.rest-modules-db', 'ml.modules-db')
rest_auth_method = conditional_prop('ml.rest-authentication-method', 'ml.authentication-method')
rest_default_user = conditional_prop('ml.rest-default-user', 'ml.default-user')

Expand All @@ -2121,9 +2122,9 @@ def build_config(config_file)
<http-server-name>@ml.app-name-rest</http-server-name>
<port>@ml.rest-port</port>
<database name="@ml.content-db"/>
<modules name="@ml.app-name-rest-modules"/>
<modules name="#{rest_modules_db}"/>
<authentication>#{rest_auth_method}</authentication>
<default-user name="#{test_default_user}"/>
<default-user name="#{rest_default_user}"/>
<url-rewriter>#{rest_url_rewriter}</url-rewriter>
<error-handler>/MarkLogic/rest-api/error-handler.xqy</error-handler>
<rewrite-resolves-globally>true</rewrite-resolves-globally>
Expand All @@ -2133,17 +2134,17 @@ def build_config(config_file)
config.gsub!("@ml.rest-modules-db-xml",
%Q{
<database>
<database-name>@ml.app-name-rest-modules</database-name>
<database-name>#{rest_modules_db}</database-name>
<forests>
<forest-id name="@ml.app-name-rest-modules"/>
<forest-id name="#{rest_modules_db}"/>
</forests>
</database>
})

config.gsub!("@ml.rest-modules-db-assignment",
%Q{
<assignment>
<forest-name>@ml.app-name-rest-modules</forest-name>
<forest-name>#{rest_modules_db}</forest-name>
</assignment>
})

Expand Down
12 changes: 12 additions & 0 deletions deploy/sample/build.sample.properties
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,18 @@ app-port=8040
xcc-port=8041
# odbc-port=8043

## Separate REST api instance
#
# In case you don't want to expose a REST api directly, or want to
# run a REST api next to a different app server, uncomment the
# rest-port property. Additionally you can override modules-db,
# auth method, and default user as well:
#
# rest-port=8044
# rest-modules-db=${app-name}-rest-modules
# rest-authentication-method=${authentication-method}
# rest-default-user=${default-user}

#
# set this to false if you are using an existing XCC server and
# you don't want Roxy to manage it for you
Expand Down

0 comments on commit 260fcdf

Please sign in to comment.