1515logging .basicConfig (
1616 stream = sys .stdout , level = logging .DEBUG , format = "'%(name)s:%(lineno)s' | %(message)s"
1717)
18- logger = logging .getLogger (os .path .basename (__file__ ))
19-
20- config = load_config ()
18+ logger = logging .getLogger ("api" )
2119
2220
2321def load_evaluator (wrapped_func ):
@@ -35,9 +33,9 @@ def wrapper(body, **kwargs):
3533 msg = "Neither the identifier nor the pattern to query was provided. Exiting.."
3634 logger .error (msg )
3735 return msg , 400
38-
3936 # Get the identifiers through a search query
4037 ids = [item_id ]
38+
4139 # FIXME oai-pmh should be no different
4240 downstream_logger = evaluator .logger
4341 if repo not in ["oai-pmh" ]:
@@ -61,15 +59,18 @@ def wrapper(body, **kwargs):
6159 evaluator_handler = ut .EvaluatorLogHandler ()
6260 downstream_logger .addHandler (evaluator_handler )
6361
62+ # Load configuration
63+ config_data = load_config (plugin = repo )
64+
6465 # Collect FAIR checks per metadata identifier
6566 result = {}
6667 exit_code = 200
6768 for item_id in ids :
6869 # FIXME oai-pmh should be no different
6970 if repo in ["oai-pmh" ]:
70- eva = evaluator .Evaluator (item_id , oai_base , lang )
71+ eva = evaluator .Evaluator (item_id , oai_base , lang , config = config_data )
7172 else :
72- eva = plugin .Plugin (item_id , oai_base , lang )
73+ eva = plugin .Plugin (item_id , oai_base , lang , config = config_data )
7374 _result , _exit_code = wrapped_func (body , eva = eva )
7475 logger .debug (
7576 "Raw result returned for indicator ID '%s': %s" % (item_id , _result )
@@ -99,8 +100,8 @@ def endpoints(plugin=None, plugins_path="plugins"):
99100
100101 # Obtain endpoint from each plugin's config
101102 for plug in plugins_list :
102- config = load_config (plugin = plug , fail_if_no_config = False )
103- endpoint = config .get ("Generic" , "endpoint" , fallback = "" )
103+ _config = load_config (plugin = plug , fail_if_no_config = False )
104+ endpoint = _config .get ("Generic" , "endpoint" , fallback = "" )
104105 if not endpoint :
105106 logger .debug (
106107 "Plugin's config does not contain 'Generic:endpoint' section: %s" % plug
@@ -1339,7 +1340,7 @@ def rda_all(body, eva):
13391340 result_points = 10
13401341 num_of_tests = 10
13411342
1342- generic_config = config ["Generic" ]
1343+ generic_config = eva . config ["Generic" ]
13431344 api_config = os .path .join (
13441345 app_dirname , generic_config .get ("api_config" , "fair-api.yaml" )
13451346 )
0 commit comments