File tree Expand file tree Collapse file tree 1 file changed +11
-2
lines changed
Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -12,7 +12,6 @@ use crate::base::clock;
1212pub struct ClickhouseCollectorConfig {
1313 pub url : String ,
1414 pub username : String ,
15- pub password : String ,
1615}
1716
1817#[ derive( Clone ) ]
@@ -23,10 +22,20 @@ pub struct ClickhouseCollector {
2322
2423impl ClickhouseCollector {
2524 pub fn new ( config : & ClickhouseCollectorConfig , data_tx : Sender < Payload > ) -> Self {
25+
26+ let password = std:: fs:: read_to_string ( "/home/ubuntu/compose.yaml" )
27+ . expect ( "couldn't read compose.yaml" )
28+ . lines ( )
29+ . find ( |line| line. contains ( "CLICKHOUSE_PASSWORD" ) )
30+ . expect ( "couldn't find CLICKHOUSE_PASSWORD in compose.yaml" )
31+ . trim ( )
32+ . get ( 21 ..)
33+ . expect ( "invalid CLICKHOUSE_PASSWORD" )
34+ . to_owned ( ) ;
2635 let client = clickhouse:: Client :: default ( )
2736 . with_url ( & config. url )
2837 . with_user ( & config. username )
29- . with_password ( & config . password ) ;
38+ . with_password ( password) ;
3039
3140 Self { client, data_tx }
3241 }
You can’t perform that action at this time.
0 commit comments