server modifications

This commit is contained in:
cerc 2023-08-03 09:53:26 -04:00
parent beed9f4e22
commit cb9b9bb251
3 changed files with 18 additions and 16 deletions

View File

@ -9,6 +9,7 @@ import datetime
import flask
import yaml
from pathlib import Path
from flasgger import LazyJSONEncoder, Swagger
from flask import Response
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(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 = {
"headers": [],
"specs": [
{
"endpoint": 'apispec',
"route": '/v1.4/apispec.json',
"endpoint": '/api/apispec',
"route": '/api/apispec/apispec.json',
"rule_filter": lambda rule: True, # all in
"model_filter": lambda tag: True, # all in
}
],
"static_url_path": "/api/v1.4/static",
"specs_route": "/v1.4/api-docs/",
"static_url_path": "/api/static",
"specs_route": "/api/api-docs/",
"openapi": "3.0.0"
}
try:

View File

@ -15,9 +15,9 @@ from hub.catalog_factories.energy_systems_catalog_factory import EnergySystemsCa
class Config:
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':
dotenv_path = Path('/home/guille/.local/etc/hub/.env').resolve()
dotenv_path = Path(dotenv_path).resolve()
environment = 'TEST'
database_name = 'montreal_retrofit_test'

View File

@ -9,7 +9,7 @@ externalDocs:
description: Find out more about Swagger
url: http://swagger.io
paths:
/v1.4/uptime:
/api/v1.4/uptime:
get:
parameters:
[]
@ -26,7 +26,7 @@ paths:
schema:
$ref: '#/components/schemas/uptime'
/v1.4/session/start:
/api/v1.4/session/start:
put:
parameters:
- in: header
@ -78,7 +78,7 @@ paths:
schema:
$ref: '#/components/schemas/unauthorized'
/v1.4/session/keep-alive:
/api/v1.4/session/keep-alive:
put:
security:
- session-id: []
@ -111,7 +111,7 @@ paths:
schema:
$ref: '#/components/schemas/unauthorized'
/v1.4/session/end:
/api/v1.4/session/end:
put:
security:
- session-id: []
@ -144,7 +144,7 @@ paths:
schema:
$ref: '#/components/schemas/unauthorized'
/v1.4/persistence/retrofit-results:
/api/v1.4/persistence/retrofit-results:
post:
security:
- session-id: [ ]
@ -192,7 +192,7 @@ paths:
schema:
$ref: '#/components/schemas/unauthorized'
/v1.4/workflow/costs:
/api/v1.4/workflow/costs:
post:
security:
- session-id: [ ]
@ -213,7 +213,7 @@ paths:
schema:
$ref: '#/components/schemas/not-implemented-error'
/v1.4/workflow/energy-plus:
/api/v1.4/workflow/energy-plus:
post:
security:
- session-id: [ ]
@ -234,7 +234,7 @@ paths:
schema:
$ref: '#/components/schemas/not-implemented-error'
/v1.4/workflow/insel-monthly-energy-balance:
/api/v1.4/workflow/insel-monthly-energy-balance:
post:
security:
- session-id: [ ]