From 8eea6d3373805417197c6e892f7cc78492cc4378 Mon Sep 17 00:00:00 2001 From: Valentyn Faychuk Date: Mon, 2 Dec 2024 04:27:10 +0200 Subject: [PATCH] create logs file if not existing Signed-off-by: Valentyn Faychuk --- scripts/package.sh | 1 - src/main.rs | 2 +- src/persistence.rs | 5 +++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/package.sh b/scripts/package.sh index 6572417..68c36e8 100755 --- a/scripts/package.sh +++ b/scripts/package.sh @@ -12,7 +12,6 @@ if [ "$prerequisites" == "--prep" ]; then rustup install stable-x86_64-unknown-linux-gnu rustup default stable rustup target add x86_64-unknown-linux-musl - echo "net.git-fetch-with-cli = true" >> /root/.cargo/config.toml mkdir -p /root/.ssh diff --git a/src/main.rs b/src/main.rs index a850281..5c5f015 100644 --- a/src/main.rs +++ b/src/main.rs @@ -22,7 +22,7 @@ use tokio::{ }; const INIT_NODES_FILE: &str = "/host/detee_challenge_nodes"; -const KEYS_FILE: &str = "/host/TRY_TO_HACK_THIS"; +const KEYS_FILE: &str = "/host/main/TRY_TO_HACK_THIS"; const MAX_CONNECTIONS: usize = 3; pub async fn localhost_cron(state: Arc, tx: Sender) { diff --git a/src/persistence.rs b/src/persistence.rs index 6de9a81..519b879 100644 --- a/src/persistence.rs +++ b/src/persistence.rs @@ -50,15 +50,16 @@ impl KeysFile { } } -const LOG_PATH: &str = "/host/logs"; +const LOG_PATH: &str = "/host/main/logs"; pub struct Logfile {} impl Logfile { pub fn append(msg: &str) -> Result<(), Box> { use std::io::Write; - let mut file = std::fs::OpenOptions::new().append(true).open(LOG_PATH)?; + let mut file = std::fs::OpenOptions::new().create(true).append(true).open(LOG_PATH)?; file.write_all(msg.as_bytes())?; + file.write_all(b"\n")?; Ok(()) } }