@@ -179,6 +179,7 @@ pub struct User {
179
179
pub username : String ,
180
180
pub password : Option < String > ,
181
181
pub pool_size : u32 ,
182
+ pub pool_mode : Option < PoolMode > ,
182
183
#[ serde( default ) ] // 0
183
184
pub statement_timeout : u64 ,
184
185
}
@@ -190,6 +191,7 @@ impl Default for User {
190
191
password : None ,
191
192
pool_size : 15 ,
192
193
statement_timeout : 0 ,
194
+ pool_mode : None ,
193
195
}
194
196
}
195
197
}
@@ -201,7 +203,7 @@ pub struct General {
201
203
pub host : String ,
202
204
203
205
#[ serde( default = "General::default_port" ) ]
204
- pub port : i16 ,
206
+ pub port : u16 ,
205
207
206
208
pub enable_prometheus_exporter : Option < bool > ,
207
209
pub prometheus_exporter_port : i16 ,
@@ -261,7 +263,7 @@ impl General {
261
263
"0.0.0.0" . into ( )
262
264
}
263
265
264
- pub fn default_port ( ) -> i16 {
266
+ pub fn default_port ( ) -> u16 {
265
267
5432
266
268
}
267
269
@@ -356,6 +358,7 @@ pub enum PoolMode {
356
358
#[ serde( alias = "session" , alias = "Session" ) ]
357
359
Session ,
358
360
}
361
+
359
362
impl ToString for PoolMode {
360
363
fn to_string ( & self ) -> String {
361
364
match * self {
@@ -816,8 +819,9 @@ impl Config {
816
819
. to_string( )
817
820
) ;
818
821
info ! (
819
- "[pool: {}] Pool mode: {:?}" ,
820
- pool_name, pool_config. pool_mode
822
+ "[pool: {}] Default pool mode: {}" ,
823
+ pool_name,
824
+ pool_config. pool_mode. to_string( )
821
825
) ;
822
826
info ! (
823
827
"[pool: {}] Load Balancing mode: {:?}" ,
@@ -868,7 +872,16 @@ impl Config {
868
872
info ! (
869
873
"[pool: {}][user: {}] Statement timeout: {}" ,
870
874
pool_name, user. 1 . username, user. 1 . statement_timeout
871
- )
875
+ ) ;
876
+ info ! (
877
+ "[pool: {}][user: {}] Pool mode: {}" ,
878
+ pool_name,
879
+ user. 1 . username,
880
+ match user. 1 . pool_mode {
881
+ Some ( pool_mode) => pool_mode. to_string( ) ,
882
+ None => pool_config. pool_mode. to_string( ) ,
883
+ }
884
+ ) ;
872
885
}
873
886
}
874
887
}
0 commit comments