1+ mod downloading;
12mod github_processor;
23mod job_processor;
34mod runner;
@@ -10,8 +11,8 @@ use diffbot_lib::{
1011} ;
1112use mysql_async:: prelude:: Queryable ;
1213use octocrab:: OctocrabBuilder ;
13- use once_cell:: sync:: OnceCell ;
1414use serde:: Deserialize ;
15+ use std:: sync:: OnceLock ;
1516use std:: {
1617 fs:: File ,
1718 io:: Read ,
@@ -64,6 +65,8 @@ pub struct Config {
6465 pub blacklist_contact : String ,
6566 #[ serde( default = "default_log_level" ) ]
6667 pub logging : String ,
68+ #[ serde( default = "default_msg" ) ]
69+ pub summary_msg : String ,
6770 pub secret : Option < String > ,
6871 pub db_url : Option < String > ,
6972 pub grafana_loki : Option < GrafanaLoki > ,
@@ -73,7 +76,11 @@ fn default_log_level() -> String {
7376 "info" . to_string ( )
7477}
7578
76- static CONFIG : OnceCell < Config > = OnceCell :: new ( ) ;
79+ fn default_msg ( ) -> String {
80+ "*Please file any issues [here](https://github.com/spacestation13/BYONDDiffBots/issues).*\n \n Icons with diff:" . to_string ( )
81+ }
82+
83+ static CONFIG : OnceLock < Config > = OnceLock :: new ( ) ;
7784// static FLAME_LAYER_GUARD: OnceCell<tracing_flame::FlushGuard<std::io::BufWriter<File>>> =
7885// OnceCell::new();
7986
@@ -87,6 +94,10 @@ fn init_config(path: &Path) -> eyre::Result<&'static Config> {
8794 Ok ( CONFIG . get ( ) . unwrap ( ) )
8895}
8996
97+ fn read_config ( ) -> & ' static Config {
98+ CONFIG . get ( ) . unwrap ( )
99+ }
100+
90101// fn init_global_subscriber() {
91102// use tracing_subscriber::prelude::*;
92103
@@ -109,7 +120,7 @@ fn read_key(path: &Path) -> Vec<u8> {
109120 File :: open ( path) . unwrap_or_else ( |_| panic ! ( "Unable to find file {}" , path. display( ) ) ) ;
110121
111122 let mut key = Vec :: new ( ) ;
112- let _ = key_file
123+ _ = key_file
113124 . read_to_end ( & mut key)
114125 . unwrap_or_else ( |_| panic ! ( "Failed to read key {}" , path. display( ) ) ) ;
115126
@@ -151,6 +162,7 @@ async fn main() -> eyre::Result<()> {
151162 . build ( )
152163 . expect ( "fucked up octocrab" ) ,
153164 ) ;
165+ let reqwest_client = reqwest:: Client :: new ( ) ;
154166
155167 async_fs:: create_dir_all ( "./images" ) . await . unwrap ( ) ;
156168
@@ -178,7 +190,11 @@ async fn main() -> eyre::Result<()> {
178190 . await ?;
179191 }
180192
181- actix_web:: rt:: spawn ( runner:: handle_jobs ( "IconDiffBot2" , job_receiver) ) ;
193+ actix_web:: rt:: spawn ( runner:: handle_jobs (
194+ "IconDiffBot2" ,
195+ job_receiver,
196+ reqwest_client,
197+ ) ) ;
182198
183199 let job_sender: DataJobSender = actix_web:: web:: Data :: new ( job_sender) ;
184200
0 commit comments