implement bind configuration

This commit is contained in:
Tom Kralidis
2018-04-01 22:06:30 -04:00
parent 2185d75d88
commit 557a9e3480
3 changed files with 8 additions and 12 deletions
+4 -3
View File
@@ -1,7 +1,8 @@
server:
host: localhost
port: 5000
basepath: /
bind:
host: localhost
port: 5000
url: http://geo.kralidis.ca/pygeoapi
mimetype: application/json; charset=UTF-8
encoding: utf-8
language: en-US
+3 -5
View File
@@ -39,7 +39,6 @@ from flask_cors import CORS
from pygeoapi import views
from pygeoapi.config import settings
from pygeoapi.log import setup_logger
from pygeoapi.util import get_url
APP = Flask(__name__)
APP.url_map.strict_slashes = False
@@ -129,8 +128,7 @@ def serve(ctx, debug=False):
setup_logger()
# TODO: get scheme
BASEURL = get_url('http', settings['server']['host'],
settings['server']['port'],
settings['server']['basepath'])
BASEURL = settings['server']['url']
APP.config['PYGEOAPI_BASEURL'] = BASEURL
APP.run(debug=True, host='0.0.0.0', port=settings['server']['port'])
APP.run(debug=True, host='0.0.0.0',
port=settings['server']['bind']['port'])
+1 -4
View File
@@ -69,11 +69,8 @@ def get_oas_30(cfg):
}
oas['info'] = info
url = 'http://{}'.format(cfg['server']['host'])
if cfg['server']['port'] not in [80, 443]:
url = '{}:{}'.format(url, cfg['server']['port'])
oas['servers'] = [{
'url': url,
'url': cfg['server']['url'],
'description': cfg['metadata']['identification']['description']
}]