@@ -8,7 +8,11 @@ use pyo3::prelude::*;
88use pyo3:: types:: { PyDict , PyFunction , PyList , PyString , PyTuple } ;
99
1010fn python_load_config ( mut cx : FunctionContext ) -> JsResult < JsPromise > {
11- let config_file_content = cx. argument :: < JsString > ( 0 ) ?. value ( & mut cx) ;
11+ let file_content_arg = cx. argument :: < JsString > ( 0 ) ?. value ( & mut cx) ;
12+ let options_arg = cx. argument :: < JsObject > ( 1 ) ?;
13+ let options_file_name = options_arg
14+ . get :: < JsString , _ , _ > ( & mut cx, "fileName" ) ?
15+ . value ( & mut cx) ;
1216
1317 let ( deferred, promise) = cx. promise ( ) ;
1418 let channel = cx. channel ( ) ;
@@ -22,7 +26,7 @@ fn python_load_config(mut cx: FunctionContext) -> JsResult<JsPromise> {
2226 ) ) ;
2327 PyModule :: from_code ( py, cube_conf_code, "__init__.py" , "cube.conf" ) ?;
2428
25- let config_module = PyModule :: from_code ( py, & config_file_content , "config.py" , "" ) ?;
29+ let config_module = PyModule :: from_code ( py, & file_content_arg , & options_file_name , "" ) ?;
2630 let settings_py = if config_module. hasattr ( "__execution_context_locals" ) ? {
2731 let execution_context_locals = config_module. getattr ( "__execution_context_locals" ) ?;
2832 execution_context_locals. get_item ( "settings" ) ?
0 commit comments