Commit b4c3c202 authored by Stavros-Anastasios Charismiadis's avatar Stavros-Anastasios Charismiadis
Browse files

Fix register issue and deploy Onboard_Provider service in production server

parent aa2a3c64
Loading
Loading
Loading
Loading
Loading
+21 −20
Original line number Diff line number Diff line
@@ -3,10 +3,10 @@
import connexion
import logging

from api_provider_management import encoder
import encoder
from flask_jwt_extended import JWTManager
from logging.handlers import RotatingFileHandler
from .config import Config
from config import Config
import os
import sys
from fluent import sender
@@ -106,7 +106,8 @@ def verbose_formatter():
        datefmt='%d/%m/%Y %H:%M:%S'
    )

def main():
# def main():


with open("/usr/src/app/api_provider_management/pubkey.pem", "rb") as pub_file:
        pub_data = pub_file.read()
@@ -129,8 +130,8 @@ def main():
JWTManager(app.app)


    app.run(port=8080, debug=True)
# app.run(port=8080, debug=True)


if __name__ == '__main__':
    main()
# if __name__ == '__main__':
#     main()
+1 −1
Original line number Diff line number Diff line
@@ -5,7 +5,7 @@ import os
class Config:
	def __init__(self):
		self.cached = 0
		self.file="./config.yaml"
		self.file="../config.yaml"
		self.my_config = {}
		stamp = os.stat(self.file).st_mtime
		if stamp != self.cached:
+7 −5
Original line number Diff line number Diff line
@@ -3,17 +3,19 @@ import six
import json

from flask import Response, request, current_app

from ..core.provider_enrolment_details_api import ProviderManagementOperations
from ..encoder import JSONEncoder
from api_provider_management.models.api_provider_enrolment_details import APIProviderEnrolmentDetails  # noqa: E501
from api_provider_management.models.problem_details import ProblemDetails  # noqa: E501
from api_provider_management import util
from ..models.api_provider_enrolment_details import APIProviderEnrolmentDetails  # noqa: E501
from ..models.problem_details import ProblemDetails  # noqa: E501
from .. import util
from ..core.validate_user import ControlAccess

from cryptography import x509
from cryptography.hazmat.backends import default_backend
from flask_jwt_extended import jwt_required, get_jwt_identity
from cryptography import x509
from functools import wraps
from ..core.validate_user import ControlAccess


import sys

+5 −4
Original line number Diff line number Diff line
@@ -6,10 +6,11 @@ import json
from flask import Response, request, current_app
from ..core.provider_enrolment_details_api import ProviderManagementOperations
from ..encoder import JSONEncoder
from api_provider_management.models.api_provider_enrolment_details import APIProviderEnrolmentDetails  # noqa: E501
from api_provider_management.models.api_provider_enrolment_details_patch import APIProviderEnrolmentDetailsPatch  # noqa: E501
from api_provider_management.models.problem_details import ProblemDetails  # noqa: E501
from api_provider_management import util
from ..models.api_provider_enrolment_details import APIProviderEnrolmentDetails  # noqa: E501
from ..models.api_provider_enrolment_details_patch import APIProviderEnrolmentDetailsPatch  # noqa: E501
from ..models.problem_details import ProblemDetails  # noqa: E501
from .. import util

from cryptography.hazmat.backends import default_backend
from cryptography import x509

+3 −2
Original line number Diff line number Diff line
@@ -45,7 +45,7 @@ class ProviderManagementOperations(Resource):

            api_provider_enrolment_details.api_prov_dom_id = secrets.token_hex(15)

            current_app.logger.debug("Geretaing certs to api prov funcs")
            current_app.logger.debug("Generating certs to api prov funcs")

            for api_provider_func in api_provider_enrolment_details.api_prov_funcs:
                api_provider_func.api_prov_func_id = api_provider_func.api_prov_func_role + str(secrets.token_hex(15))
@@ -64,7 +64,8 @@ class ProviderManagementOperations(Resource):
            
            current_app.logger.debug("Provider inserted in database")

            res = make_response(object=api_provider_enrolment_details, status=201)
            res = make_response(object=dict_to_camel_case(api_provider_enrolment_details.to_dict()), status=201)

            res.headers['Location'] = "/api-provider-management/v1/registrations/" + str(api_provider_enrolment_details.api_prov_dom_id)
            return res

Loading