Add api_domain to configuration

This commit is contained in:
Eric Schultz 2018-09-06 12:03:42 -05:00
parent c552851efc
commit faf1d7d84a
4 changed files with 14 additions and 3 deletions

View file

@ -14,9 +14,9 @@ class Houdini::V1::API < Grape::API
mount Houdini::V1::Nonprofit => '/nonprofit' mount Houdini::V1::Nonprofit => '/nonprofit'
# Additional mounts are added via generators above this line # Additional mounts are added via generators above this line
# DON'T REMOVE THIS OR THE PREVIOUS LINES!!! # DON'T REMOVE THIS OR THE PREVIOUS LINES!!!
uriForHost = URI.parse(Settings.cdn.url) uri_for_host = URI.parse(Settings.api_domain&.url || Settings.cdn.url)
add_swagger_documentation \ add_swagger_documentation \
host: "#{uriForHost.host}#{Settings.cdn.port ? ":#{Settings.cdn.port}" : ""}", host: "#{uri_for_host.host}#{uri_for_host.port ? ":#{uri_for_host.port}" : ""}",
schemes: [uriForHost.scheme], schemes: [uri_for_host.scheme],
base_path: '/api/v1' base_path: '/api/v1'
end end

View file

@ -27,3 +27,6 @@ intntl:
symbol: "€" symbol: "€"
abbv: "eur" abbv: "eur"
format: "%n%u" format: "%n%u"
api_domain:
url: "http://localhost:5000"

View file

@ -284,6 +284,11 @@ Config.schema do
required(:url).filled?(:str) required(:url).filled?(:str)
end end
# the domain for your api. Usually will be your CDN.url
optional(:api_domain).schema do
required(:url).filled?(:str)
end
end end
Settings.reload! Settings.reload!

View file

@ -73,3 +73,6 @@ source_tokens:
nonprofits_must_be_vetted: false nonprofits_must_be_vetted: false
api_domain:
url: "http://localhost:5000"