mirror of
https://github.com/serai-dex/serai.git
synced 2025-12-08 04:09:23 +00:00
Update how RPCs are handled
The processor now takes three vars and joins them itself. message-queue uses a single argument, with defaults, as it's a service we control.
This commit is contained in:
@@ -26,8 +26,17 @@ pub struct MessageQueue {
|
||||
}
|
||||
|
||||
impl MessageQueue {
|
||||
pub fn new(service: Service) -> MessageQueue {
|
||||
let url = env::var("MESSAGE_QUEUE_RPC").expect("message-queue RPC wasn't specified");
|
||||
pub fn from_env(service: Service) -> MessageQueue {
|
||||
// Allow MESSAGE_QUEUE_RPC to either be a full URL or just a hostname
|
||||
// While we could stitch together multiple env variables, our control over this service makes
|
||||
// this fine
|
||||
let mut url = env::var("MESSAGE_QUEUE_RPC").expect("message-queue RPC wasn't specified");
|
||||
if !url.contains(':') {
|
||||
url += ":2287";
|
||||
}
|
||||
if !url.starts_with("http://") {
|
||||
url = "http://".to_string() + &url;
|
||||
}
|
||||
|
||||
let priv_key: Zeroizing<<Ristretto as Ciphersuite>::F> = {
|
||||
let key_str =
|
||||
|
||||
@@ -110,7 +110,7 @@ fn ack_message(service: Service, id: u64, sig: SchnorrSignature<Ristretto>) {
|
||||
#[tokio::main]
|
||||
async fn main() {
|
||||
if std::env::var("RUST_LOG").is_err() {
|
||||
std::env::set_var("RUST_LOG", "info");
|
||||
std::env::set_var("RUST_LOG", serai_env::var("RUST_LOG").unwrap_or_else(|| "info".to_string()));
|
||||
}
|
||||
env_logger::init();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user