create logs file if not existing
Signed-off-by: Valentyn Faychuk <valy@detee.ltd>
This commit is contained in:
parent
2a87efacc1
commit
8eea6d3373
@ -12,7 +12,6 @@ if [ "$prerequisites" == "--prep" ]; then
|
|||||||
rustup install stable-x86_64-unknown-linux-gnu
|
rustup install stable-x86_64-unknown-linux-gnu
|
||||||
rustup default stable
|
rustup default stable
|
||||||
rustup target add x86_64-unknown-linux-musl
|
rustup target add x86_64-unknown-linux-musl
|
||||||
echo "net.git-fetch-with-cli = true" >> /root/.cargo/config.toml
|
|
||||||
|
|
||||||
mkdir -p /root/.ssh
|
mkdir -p /root/.ssh
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@ use tokio::{
|
|||||||
};
|
};
|
||||||
|
|
||||||
const INIT_NODES_FILE: &str = "/host/detee_challenge_nodes";
|
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;
|
const MAX_CONNECTIONS: usize = 3;
|
||||||
|
|
||||||
pub async fn localhost_cron(state: Arc<State>, tx: Sender<NodeUpdate>) {
|
pub async fn localhost_cron(state: Arc<State>, tx: Sender<NodeUpdate>) {
|
||||||
|
@ -50,15 +50,16 @@ impl KeysFile {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const LOG_PATH: &str = "/host/logs";
|
const LOG_PATH: &str = "/host/main/logs";
|
||||||
|
|
||||||
pub struct Logfile {}
|
pub struct Logfile {}
|
||||||
|
|
||||||
impl Logfile {
|
impl Logfile {
|
||||||
pub fn append(msg: &str) -> Result<(), Box<dyn std::error::Error>> {
|
pub fn append(msg: &str) -> Result<(), Box<dyn std::error::Error>> {
|
||||||
use std::io::Write;
|
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(msg.as_bytes())?;
|
||||||
|
file.write_all(b"\n")?;
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user