summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoriximeow <git@iximeow.net>2022-12-26 00:10:35 +0000
committeriximeow <git@iximeow.net>2022-12-26 00:10:35 +0000
commitc6831877b452b5e7631ad2baec3d96b199003017 (patch)
treef0b76510c0478ce2ab916e7dca43b271f847a976
parentcb418168d9375d4ea6c9d21ee6b97e02a575fb4b (diff)
... use actual tokens
-rw-r--r--Cargo.lock1
-rw-r--r--Cargo.toml1
-rw-r--r--src/ci_driver.rs10
3 files changed, 11 insertions, 1 deletions
diff --git a/Cargo.lock b/Cargo.lock
index e071611..3487328 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -705,6 +705,7 @@ dependencies = [
"axum",
"axum-macros",
"axum-server",
+ "base64",
"clap",
"futures-util",
"handlebars",
diff --git a/Cargo.toml b/Cargo.toml
index 4111953..5452c83 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -21,6 +21,7 @@ hyper = "*"
futures-util = "*"
axum-macros = "*"
lettre = "*"
+base64 = "*"
tracing = "*"
tracing-subscriber = "*"
http-body = "*"
diff --git a/src/ci_driver.rs b/src/ci_driver.rs
index 9ec0dd8..94e55a0 100644
--- a/src/ci_driver.rs
+++ b/src/ci_driver.rs
@@ -1,4 +1,6 @@
use std::process::Command;
+use std::io::Read;
+use serde_derive::{Deserialize, Serialize};
use futures_util::StreamExt;
use std::fmt;
use std::path::{Path, PathBuf};
@@ -126,7 +128,13 @@ fn random_name() -> String {
}
fn token_for_job() -> String {
- "very secret token do not share".to_string()
+ let mut data = [0u8; 32];
+ std::fs::File::open("/dev/urandom")
+ .unwrap()
+ .read_exact(&mut data)
+ .unwrap();
+
+ base64::encode(data)
}
struct ClientJob {