try to fix db connection

This commit is contained in:
cerc 2023-04-03 14:51:21 -04:00
parent e7c49e7e25
commit 7be95d7cc5
3 changed files with 15 additions and 14 deletions

View File

@ -16,10 +16,10 @@ class Config:
def __init__(self):
dotenv_path = "{}/.env".format(os.path.expanduser('~'))
if platform.system() == 'Linux':
dotenv_path = Path('/usr/local/etc/hub/.env').resolve()
dotenv_path = Path('/.local/etc/hub_api/.env').resolve()
environment = 'TEST'
database_name = 'persistence_test'
database_name = 'montreal_retrofit_test'
self.export_db_factory = CityExportFactory(db_name=database_name, app_env=environment,
dotenv_path=dotenv_path)

View File

@ -22,9 +22,10 @@ class SessionStart(Resource, Config):
def put(self):
username = request.headers.get('username', None)
password = request.headers.get('password', None)
application_uuid = request.headers.get('application_uuid', None)
application_uuid = request.headers.get('application-uuid', None)
ip = request.remote_addr
user_info = self.export_db_factory.user_login(name=username, password=password, application_uuid=application_uuid)
print(user_info, username, password, application_uuid)
if user_info:
session_id = str(uuid.uuid4())
token = str(uuid.uuid4())

View File

@ -41,7 +41,7 @@ paths:
required: true
description: the password for the user accessing this API
- in: header
name: application_uuid
name: application-uuid
schema:
type: string
required: true
@ -49,7 +49,7 @@ paths:
tags:
- Session start
summary: Starts an user session
operationId: session_start
operationId: session-start
description: Authentication and initialization of a user session in the Api
responses:
'200':
@ -59,7 +59,7 @@ paths:
schema:
$ref: '#/components/schemas/login_succeed'
headers:
session_id:
session-id:
type: string
format: uuid
description: Session id
@ -78,9 +78,9 @@ paths:
/api/v1.4/session/keep_alive:
put:
security:
- session_id: []
- session-id: []
- token: []
- application_uuid: []
- application-uuid: []
parameters:
[]
tags:
@ -110,7 +110,7 @@ paths:
/api/v1.4/session/end:
put:
security:
- session_id: []
- session-id: []
- token: []
- application_uuid: []
parameters:
@ -142,7 +142,7 @@ paths:
/api/v1.4/buildings/meb:
post:
security:
- session_id: [ ]
- session-id: [ ]
- token: [ ]
- application_uuid: [ ]
requestBody:
@ -182,14 +182,14 @@ paths:
$ref: '#/components/schemas/unauthorized'
components:
securitySchemes:
session_id:
session-id:
type: apiKey
in: header
name: session_id
application_uuid:
name: session-id
application-uuid:
type: apiKey
in: header
name: application_uuid
name: application-uuid
token:
type: apiKey
in: header