@@ -93,9 +93,6 @@ pub struct Config {
9393 // - currently only supports HIVE (via hive meta store)
9494 #[ clap( flatten) ]
9595 pub catalog : HiveCatalogConfig ,
96-
97- #[ clap( skip) ]
98- pub idm : IDMConfig ,
9996}
10097
10198impl Default for Config {
@@ -148,7 +145,6 @@ impl From<InnerConfig> for Config {
148145 meta : inner. meta . into ( ) ,
149146 storage : inner. storage . into ( ) ,
150147 catalog : inner. catalog . into ( ) ,
151- idm : inner. idm . into ( ) ,
152148 }
153149 }
154150}
@@ -165,7 +161,6 @@ impl TryInto<InnerConfig> for Config {
165161 meta : self . meta . try_into ( ) ?,
166162 storage : self . storage . try_into ( ) ?,
167163 catalog : self . catalog . try_into ( ) ?,
168- idm : self . idm . try_into ( ) ?,
169164 } )
170165 }
171166}
@@ -826,6 +821,9 @@ pub struct QueryConfig {
826821 /// The maximum timeout in milliseconds since the last insert before inserting collected data.
827822 #[ clap( long, default_value = "0" ) ]
828823 pub async_insert_stale_timeout : u64 ,
824+
825+ #[ clap( skip) ]
826+ users : Vec < UserConfig > ,
829827}
830828
831829impl Default for QueryConfig {
@@ -878,6 +876,9 @@ impl TryInto<InnerQueryConfig> for QueryConfig {
878876 async_insert_max_data_size : self . async_insert_max_data_size ,
879877 async_insert_busy_timeout : self . async_insert_busy_timeout ,
880878 async_insert_stale_timeout : self . async_insert_stale_timeout ,
879+ idm : InnerIDMConfig {
880+ users : users_to_inner ( self . users ) ?,
881+ } ,
881882 } )
882883 }
883884}
@@ -931,6 +932,7 @@ impl From<InnerQueryConfig> for QueryConfig {
931932 async_insert_max_data_size : inner. async_insert_max_data_size ,
932933 async_insert_busy_timeout : inner. async_insert_busy_timeout ,
933934 async_insert_stale_timeout : inner. async_insert_stale_timeout ,
935+ users : users_from_inner ( inner. idm . users ) ,
934936 }
935937 }
936938}
@@ -1229,36 +1231,22 @@ impl Debug for MetaConfig {
12291231 }
12301232}
12311233
1232- #[ derive( Clone , Debug , Default , PartialEq , Eq , Serialize , Deserialize ) ]
1233- pub struct IDMConfig {
1234- users : Vec < UserConfig > ,
1235- }
1236-
1237- impl TryInto < InnerIDMConfig > for IDMConfig {
1238- type Error = ErrorCode ;
1239-
1240- fn try_into ( self ) -> Result < InnerIDMConfig > {
1241- let mut users = HashMap :: new ( ) ;
1242- for c in self . users . into_iter ( ) {
1243- users. insert ( c. name . clone ( ) , c. auth . try_into ( ) ?) ;
1244- }
1245- Ok ( InnerIDMConfig { users } )
1246- }
1234+ fn users_from_inner ( inner : HashMap < String , AuthInfo > ) -> Vec < UserConfig > {
1235+ inner
1236+ . into_iter ( )
1237+ . map ( |( name, auth) | UserConfig {
1238+ name,
1239+ auth : auth. into ( ) ,
1240+ } )
1241+ . collect ( )
12471242}
12481243
1249- impl From < InnerIDMConfig > for IDMConfig {
1250- fn from ( inner : InnerIDMConfig ) -> Self {
1251- Self {
1252- users : inner
1253- . users
1254- . into_iter ( )
1255- . map ( |( name, auth) | UserConfig {
1256- name,
1257- auth : auth. into ( ) ,
1258- } )
1259- . collect ( ) ,
1260- }
1244+ fn users_to_inner ( outer : Vec < UserConfig > ) -> Result < HashMap < String , AuthInfo > > {
1245+ let mut inner = HashMap :: new ( ) ;
1246+ for c in outer. into_iter ( ) {
1247+ inner. insert ( c. name . clone ( ) , c. auth . try_into ( ) ?) ;
12611248 }
1249+ Ok ( inner)
12621250}
12631251
12641252#[ derive( Clone , Debug , PartialEq , Eq , Serialize , Deserialize ) ]
0 commit comments