From 7be95d7cc52788e7cea9108e76538b1f7989194e Mon Sep 17 00:00:00 2001 From: cerc Date: Mon, 3 Apr 2023 14:51:21 -0400 Subject: [PATCH] try to fix db connection --- hub_api/config.py | 4 ++-- hub_api/control/session.py | 3 ++- hub_api/docs/openapi-specs.yml | 22 +++++++++++----------- 3 files changed, 15 insertions(+), 14 deletions(-) diff --git a/hub_api/config.py b/hub_api/config.py index 0252dda..57469e0 100644 --- a/hub_api/config.py +++ b/hub_api/config.py @@ -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) diff --git a/hub_api/control/session.py b/hub_api/control/session.py index feade4a..56bee34 100644 --- a/hub_api/control/session.py +++ b/hub_api/control/session.py @@ -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()) diff --git a/hub_api/docs/openapi-specs.yml b/hub_api/docs/openapi-specs.yml index a6facbc..ab5e984 100644 --- a/hub_api/docs/openapi-specs.yml +++ b/hub_api/docs/openapi-specs.yml @@ -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