11use convert_case:: { Case , Casing } ;
22use neon:: prelude:: * ;
3- use pyo3:: exceptions:: PyTypeError ;
4- use pyo3:: types:: PyFunction ;
5- use pyo3:: { Py , PyAny , PyErr , PyResult } ;
3+ use pyo3:: { PyAny , PyResult } ;
64
75use crate :: python:: cross:: { CLRepr , CLReprObject } ;
86
@@ -28,56 +26,34 @@ impl CubeConfigPy {
2826 "cache_and_queue_driver" ,
2927 "allow_js_duplicate_props_in_schema" ,
3028 "process_subscriptions_interval" ,
29+ "http" ,
30+ "jwt" ,
3131 ]
3232 }
3333
3434 pub fn apply_dynamic_functions ( & mut self , config_module : & PyAny ) -> PyResult < ( ) > {
35- self . function_attr ( config_module, "logger" ) ?;
36- self . function_attr ( config_module, "context_to_app_id" ) ?;
37- self . function_attr ( config_module, "context_to_orchestrator_id" ) ?;
38- self . function_attr ( config_module, "driver_factory" ) ?;
39- self . function_attr ( config_module, "db_type" ) ?;
40- self . function_attr ( config_module, "check_auth" ) ?;
41- self . function_attr ( config_module, "check_sql_auth" ) ?;
42- self . function_attr ( config_module, "can_switch_sql_user" ) ?;
43- self . function_attr ( config_module, "query_rewrite" ) ?;
44- self . function_attr ( config_module, "extend_context" ) ?;
45- self . function_attr ( config_module, "scheduled_refresh_contexts" ) ?;
46- self . function_attr ( config_module, "context_to_api_scopes" ) ?;
47- self . function_attr ( config_module, "repository_factory" ) ?;
48- self . function_attr ( config_module, "semantic_layer_sync" ) ?;
49- self . function_attr ( config_module, "schema_version" ) ?;
50- self . function_attr ( config_module, "pre_aggregations_schema" ) ?;
35+ self . attr ( config_module, "logger" ) ?;
36+ self . attr ( config_module, "context_to_app_id" ) ?;
37+ self . attr ( config_module, "context_to_orchestrator_id" ) ?;
38+ self . attr ( config_module, "driver_factory" ) ?;
39+ self . attr ( config_module, "db_type" ) ?;
40+ self . attr ( config_module, "check_auth" ) ?;
41+ self . attr ( config_module, "check_sql_auth" ) ?;
42+ self . attr ( config_module, "can_switch_sql_user" ) ?;
43+ self . attr ( config_module, "query_rewrite" ) ?;
44+ self . attr ( config_module, "extend_context" ) ?;
45+ self . attr ( config_module, "scheduled_refresh_contexts" ) ?;
46+ self . attr ( config_module, "context_to_api_scopes" ) ?;
47+ self . attr ( config_module, "repository_factory" ) ?;
48+ self . attr ( config_module, "semantic_layer_sync" ) ?;
49+ self . attr ( config_module, "schema_version" ) ?;
50+ self . attr ( config_module, "pre_aggregations_schema" ) ?;
51+ self . attr ( config_module, "orchestrator_options" ) ?;
5152
5253 Ok ( ( ) )
5354 }
5455
55- pub fn function_attr < ' a > (
56- & mut self ,
57- config_module : & ' a PyAny ,
58- key : & str ,
59- ) -> PyResult < Option < Py < PyFunction > > > {
60- let v = config_module. getattr ( & * key) ?;
61- if !v. is_none ( ) {
62- if v. get_type ( ) . is_subclass_of :: < PyFunction > ( ) ? {
63- let cb = v. downcast :: < PyFunction > ( ) ?;
64- let py: Py < PyFunction > = cb. into ( ) ;
65-
66- let value = CLRepr :: PyFunction ( py) ;
67- self . properties . insert ( key. to_case ( Case :: Camel ) , value) ;
68- } else {
69- return Err ( PyErr :: new :: < PyTypeError , _ > ( format ! (
70- "Unsupported configuration type: {} for key: {}, must be a lambda" ,
71- v. get_type( ) ,
72- key
73- ) ) ) ;
74- }
75- }
76-
77- Ok ( None )
78- }
79-
80- pub fn static_attr ( & mut self , config_module : & PyAny , key : & str ) -> PyResult < ( ) > {
56+ pub fn attr ( & mut self , config_module : & PyAny , key : & str ) -> PyResult < ( ) > {
8157 let v = config_module. getattr ( & * key) ?;
8258 if !v. is_none ( ) {
8359 let value = CLRepr :: from_python_ref ( v) ?;
0 commit comments