only show STAC and OAProc endpoints if configured (#497)
This commit is contained in:
@@ -185,6 +185,18 @@ class API:
|
||||
|
||||
if format_ == 'html': # render
|
||||
headers_['Content-Type'] = 'text/html'
|
||||
|
||||
fcm['processes'] = False
|
||||
fcm['stac'] = False
|
||||
|
||||
if filter_dict_by_key_value(self.config['resources'],
|
||||
'type', 'process'):
|
||||
fcm['processes'] = True
|
||||
|
||||
if filter_dict_by_key_value(self.config['resources'],
|
||||
'type', 'stac-collection'):
|
||||
fcm['stac'] = True
|
||||
|
||||
content = render_j2_template(self.config, 'root.html', fcm)
|
||||
return headers_, 200, content
|
||||
|
||||
@@ -1168,6 +1180,7 @@ class API:
|
||||
'id': id_,
|
||||
'stac_version': stac_version,
|
||||
'description': description,
|
||||
'extent': stac_collections[dataset]['extents'],
|
||||
'links': []
|
||||
}
|
||||
try:
|
||||
|
||||
+30
-27
@@ -492,40 +492,43 @@ def get_oas_30(cfg):
|
||||
}
|
||||
|
||||
LOGGER.debug('setting up STAC')
|
||||
paths['/stac'] = {
|
||||
'get': {
|
||||
'summary': 'SpatioTemporal Asset Catalog',
|
||||
'description': 'SpatioTemporal Asset Catalog',
|
||||
'tags': ['stac'],
|
||||
'operationId': 'getStacCatalog',
|
||||
'parameters': [],
|
||||
'responses': {
|
||||
'200': {'$ref': '#/components/responses/200'},
|
||||
'default': {'$ref': '#/components/responses/default'}
|
||||
stac_collections = filter_dict_by_key_value(cfg['resources'],
|
||||
'type', 'stac-collection')
|
||||
if stac_collections:
|
||||
paths['/stac'] = {
|
||||
'get': {
|
||||
'summary': 'SpatioTemporal Asset Catalog',
|
||||
'description': 'SpatioTemporal Asset Catalog',
|
||||
'tags': ['stac'],
|
||||
'operationId': 'getStacCatalog',
|
||||
'parameters': [],
|
||||
'responses': {
|
||||
'200': {'$ref': '#/components/responses/200'},
|
||||
'default': {'$ref': '#/components/responses/default'}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
LOGGER.debug('setting up processes')
|
||||
paths['/processes'] = {
|
||||
'get': {
|
||||
'summary': 'Processes',
|
||||
'description': 'Processes',
|
||||
'tags': ['server'],
|
||||
'operationId': 'getProcesses',
|
||||
'parameters': [
|
||||
{'$ref': '#/components/parameters/f'}
|
||||
],
|
||||
'responses': {
|
||||
'200': {'$ref': '{}/responses/ProcessList.yaml'.format(OPENAPI_YAML['oapip'])}, # noqa
|
||||
'default': {'$ref': '#/components/responses/default'}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
processes = filter_dict_by_key_value(cfg['resources'], 'type', 'process')
|
||||
|
||||
if processes:
|
||||
paths['/processes'] = {
|
||||
'get': {
|
||||
'summary': 'Processes',
|
||||
'description': 'Processes',
|
||||
'tags': ['server'],
|
||||
'operationId': 'getProcesses',
|
||||
'parameters': [
|
||||
{'$ref': '#/components/parameters/f'}
|
||||
],
|
||||
'responses': {
|
||||
'200': {'$ref': '{}/responses/ProcessList.yaml'.format(OPENAPI_YAML['oapip'])}, # noqa
|
||||
'default': {'$ref': '#/components/responses/default'}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for k, v in processes.items():
|
||||
p = load_plugin('process', v['processor'])
|
||||
|
||||
|
||||
@@ -50,18 +50,22 @@
|
||||
<a href="{{ config['server']['url'] }}/collections?f=html">View the collections in this service</a>
|
||||
</p>
|
||||
</section>
|
||||
{% if data['stac'] %}
|
||||
<section id="collections">
|
||||
<h2>SpatioTemporal Assets</h2>
|
||||
<p>
|
||||
<a href="{{ config['server']['url'] }}/stac?f=html">View the SpatioTemporal Assets in this service</a>
|
||||
</p>
|
||||
</section>
|
||||
{% endif %}
|
||||
{% if data['processes'] %}
|
||||
<section id="processes">
|
||||
<h2>Processes</h2>
|
||||
<p>
|
||||
<a href="{{ config['server']['url'] }}/processes?f=html">View the processes in this service</a>
|
||||
</p>
|
||||
</section>
|
||||
{% endif %}
|
||||
<section id="openapi">
|
||||
<h2>API Definition</h2>
|
||||
<p>
|
||||
|
||||
Reference in New Issue
Block a user