server modifications
This commit is contained in:
parent
beed9f4e22
commit
cb9b9bb251
12
bootstrap.py
12
bootstrap.py
|
@ -9,6 +9,7 @@ import datetime
|
||||||
|
|
||||||
import flask
|
import flask
|
||||||
import yaml
|
import yaml
|
||||||
|
from pathlib import Path
|
||||||
from flasgger import LazyJSONEncoder, Swagger
|
from flasgger import LazyJSONEncoder, Swagger
|
||||||
from flask import Response
|
from flask import Response
|
||||||
from flask_restful import Api
|
from flask_restful import Api
|
||||||
|
@ -47,20 +48,21 @@ api.add_resource(Costs, '/v1.4/workflow/costs')
|
||||||
api.add_resource(EnergyPlus, '/v1.4/workflow/energy-plus')
|
api.add_resource(EnergyPlus, '/v1.4/workflow/energy-plus')
|
||||||
api.add_resource(InselMonthlyEnergyBalance, '/v1.4/workflow/insel-monthly-energy-balance')
|
api.add_resource(InselMonthlyEnergyBalance, '/v1.4/workflow/insel-monthly-energy-balance')
|
||||||
|
|
||||||
|
yml_path = Path('./docs/openapi-specs.yml').resolve()
|
||||||
|
|
||||||
with open("hub_api/docs/openapi-specs.yml", "r") as stream:
|
with open(yml_path, "r") as stream:
|
||||||
swagger_config = {
|
swagger_config = {
|
||||||
"headers": [],
|
"headers": [],
|
||||||
"specs": [
|
"specs": [
|
||||||
{
|
{
|
||||||
"endpoint": 'apispec',
|
"endpoint": '/api/apispec',
|
||||||
"route": '/v1.4/apispec.json',
|
"route": '/api/apispec/apispec.json',
|
||||||
"rule_filter": lambda rule: True, # all in
|
"rule_filter": lambda rule: True, # all in
|
||||||
"model_filter": lambda tag: True, # all in
|
"model_filter": lambda tag: True, # all in
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"static_url_path": "/api/v1.4/static",
|
"static_url_path": "/api/static",
|
||||||
"specs_route": "/v1.4/api-docs/",
|
"specs_route": "/api/api-docs/",
|
||||||
"openapi": "3.0.0"
|
"openapi": "3.0.0"
|
||||||
}
|
}
|
||||||
try:
|
try:
|
||||||
|
|
|
@ -15,9 +15,9 @@ from hub.catalog_factories.energy_systems_catalog_factory import EnergySystemsCa
|
||||||
class Config:
|
class Config:
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
dotenv_path = "{}/.env".format(os.path.expanduser('~'))
|
dotenv_path = "{}/.local/etc/hub_api/.env".format(os.path.expanduser('~'))
|
||||||
if platform.system() == 'Linux':
|
if platform.system() == 'Linux':
|
||||||
dotenv_path = Path('/home/guille/.local/etc/hub/.env').resolve()
|
dotenv_path = Path(dotenv_path).resolve()
|
||||||
|
|
||||||
environment = 'TEST'
|
environment = 'TEST'
|
||||||
database_name = 'montreal_retrofit_test'
|
database_name = 'montreal_retrofit_test'
|
||||||
|
|
|
@ -9,7 +9,7 @@ externalDocs:
|
||||||
description: Find out more about Swagger
|
description: Find out more about Swagger
|
||||||
url: http://swagger.io
|
url: http://swagger.io
|
||||||
paths:
|
paths:
|
||||||
/v1.4/uptime:
|
/api/v1.4/uptime:
|
||||||
get:
|
get:
|
||||||
parameters:
|
parameters:
|
||||||
[]
|
[]
|
||||||
|
@ -26,7 +26,7 @@ paths:
|
||||||
schema:
|
schema:
|
||||||
$ref: '#/components/schemas/uptime'
|
$ref: '#/components/schemas/uptime'
|
||||||
|
|
||||||
/v1.4/session/start:
|
/api/v1.4/session/start:
|
||||||
put:
|
put:
|
||||||
parameters:
|
parameters:
|
||||||
- in: header
|
- in: header
|
||||||
|
@ -78,7 +78,7 @@ paths:
|
||||||
schema:
|
schema:
|
||||||
$ref: '#/components/schemas/unauthorized'
|
$ref: '#/components/schemas/unauthorized'
|
||||||
|
|
||||||
/v1.4/session/keep-alive:
|
/api/v1.4/session/keep-alive:
|
||||||
put:
|
put:
|
||||||
security:
|
security:
|
||||||
- session-id: []
|
- session-id: []
|
||||||
|
@ -111,7 +111,7 @@ paths:
|
||||||
schema:
|
schema:
|
||||||
$ref: '#/components/schemas/unauthorized'
|
$ref: '#/components/schemas/unauthorized'
|
||||||
|
|
||||||
/v1.4/session/end:
|
/api/v1.4/session/end:
|
||||||
put:
|
put:
|
||||||
security:
|
security:
|
||||||
- session-id: []
|
- session-id: []
|
||||||
|
@ -144,7 +144,7 @@ paths:
|
||||||
schema:
|
schema:
|
||||||
$ref: '#/components/schemas/unauthorized'
|
$ref: '#/components/schemas/unauthorized'
|
||||||
|
|
||||||
/v1.4/persistence/retrofit-results:
|
/api/v1.4/persistence/retrofit-results:
|
||||||
post:
|
post:
|
||||||
security:
|
security:
|
||||||
- session-id: [ ]
|
- session-id: [ ]
|
||||||
|
@ -192,7 +192,7 @@ paths:
|
||||||
schema:
|
schema:
|
||||||
$ref: '#/components/schemas/unauthorized'
|
$ref: '#/components/schemas/unauthorized'
|
||||||
|
|
||||||
/v1.4/workflow/costs:
|
/api/v1.4/workflow/costs:
|
||||||
post:
|
post:
|
||||||
security:
|
security:
|
||||||
- session-id: [ ]
|
- session-id: [ ]
|
||||||
|
@ -213,7 +213,7 @@ paths:
|
||||||
schema:
|
schema:
|
||||||
$ref: '#/components/schemas/not-implemented-error'
|
$ref: '#/components/schemas/not-implemented-error'
|
||||||
|
|
||||||
/v1.4/workflow/energy-plus:
|
/api/v1.4/workflow/energy-plus:
|
||||||
post:
|
post:
|
||||||
security:
|
security:
|
||||||
- session-id: [ ]
|
- session-id: [ ]
|
||||||
|
@ -234,7 +234,7 @@ paths:
|
||||||
schema:
|
schema:
|
||||||
$ref: '#/components/schemas/not-implemented-error'
|
$ref: '#/components/schemas/not-implemented-error'
|
||||||
|
|
||||||
/v1.4/workflow/insel-monthly-energy-balance:
|
/api/v1.4/workflow/insel-monthly-energy-balance:
|
||||||
post:
|
post:
|
||||||
security:
|
security:
|
||||||
- session-id: [ ]
|
- session-id: [ ]
|
||||||
|
@ -579,4 +579,4 @@ components:
|
||||||
properties:
|
properties:
|
||||||
error:
|
error:
|
||||||
type: string
|
type: string
|
||||||
example: 'NotImplementedError'
|
example: 'NotImplementedError'
|
||||||
|
|
Loading…
Reference in New Issue
Block a user