change: change build for multi-platform
- fix: commit message empty - fix: sheet api json not found may cause app unable to run Signed-off-by: Pakin <pakin.t@forth.co.th>
This commit is contained in:
parent
3c3d087b62
commit
4860fd950a
7 changed files with 332 additions and 225 deletions
|
|
@ -1,3 +1,4 @@
|
|||
use std::path::PathBuf;
|
||||
use std::{cmp::Ordering, collections::HashMap, fs::File, io::BufReader};
|
||||
|
||||
use crate::websocket::core::{LAST_CHANGE_DATE_FORMAT, safe_deserialize};
|
||||
|
|
@ -5,6 +6,7 @@ use crate::websocket::core::{LAST_CHANGE_DATE_FORMAT, safe_deserialize};
|
|||
use super::model::*;
|
||||
use axum::extract::ws::{CloseFrame, Message, WebSocket};
|
||||
use chrono::NaiveDateTime;
|
||||
use log::{error, info};
|
||||
use redis::{TypedCommands, cmd};
|
||||
|
||||
#[deprecated]
|
||||
|
|
@ -91,7 +93,26 @@ pub fn get_extra_parameters(s: String) -> HashMap<String, String> {
|
|||
pub fn read_sheet_config() -> Result<Vec<String>, Box<dyn std::error::Error>> {
|
||||
let mut res = Vec::new();
|
||||
|
||||
let config_file = File::open("./sheet-api.json")?;
|
||||
info!("[sheet_config] reading sheet config");
|
||||
let expect_file_path = "./sheet-api.json";
|
||||
let config_file = match File::open(expect_file_path) {
|
||||
Ok(f) => f,
|
||||
Err(e) => {
|
||||
error!("error file not found {e}");
|
||||
// check again if file existed
|
||||
|
||||
let path = PathBuf::from(expect_file_path);
|
||||
info!(
|
||||
"retry check again, is file exist {:?} = {}",
|
||||
expect_file_path.to_string(),
|
||||
path.exists()
|
||||
);
|
||||
|
||||
res.push("junk".to_string());
|
||||
|
||||
return Ok(res);
|
||||
}
|
||||
};
|
||||
let mut buf = BufReader::new(config_file);
|
||||
|
||||
let val: serde_json::Value = serde_json::from_reader(&mut buf)?;
|
||||
|
|
|
|||
|
|
@ -596,6 +596,7 @@ pub async fn handle_recipe_save_change_request(
|
|||
} else {
|
||||
// CASE: new recipe, do add
|
||||
info!("[save_recipe] add recipe {}", single_recipe.productCode);
|
||||
commit_message.push_str(format!("add recipe {}", single_recipe.productCode).as_str());
|
||||
result.Recipe01.push(single_recipe);
|
||||
}
|
||||
|
||||
|
|
@ -612,7 +613,7 @@ pub async fn handle_recipe_save_change_request(
|
|||
path: expected_file_path.clone(),
|
||||
signature_username: display_name,
|
||||
signature_email: email,
|
||||
message: format!(""),
|
||||
message: commit_message,
|
||||
};
|
||||
|
||||
if let Err(commit_error) = invoke_commit_request(config, commit_payload.clone()).await {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue