mirror of
https://github.com/serai-dex/serai.git
synced 2025-12-08 04:09:23 +00:00
Add common crate to access env variables
In the future, we should use a proper secret store (not just env variables). This lets us update one block of code and not n in the future.
This commit is contained in:
@@ -35,6 +35,8 @@ tokio = { version = "1", features = ["full"] }
|
||||
serai-db = { path = "../common/db", features = ["rocksdb"] }
|
||||
rocksdb = "0.21"
|
||||
|
||||
serai-env = { path = "../common/env" }
|
||||
|
||||
serai-primitives = { path = "../substrate/primitives" }
|
||||
|
||||
jsonrpsee = { version = "0.16", features = ["server"] }
|
||||
|
||||
@@ -100,10 +100,10 @@ fn ack_message(service: Service, id: u64, _signature: SchnorrSignature<Ristretto
|
||||
async fn main() {
|
||||
// Open the DB
|
||||
let db =
|
||||
Arc::new(rocksdb::TransactionDB::open_default(std::env::var("DB_PATH").unwrap()).unwrap());
|
||||
Arc::new(rocksdb::TransactionDB::open_default(serai_env::var("DB_PATH").unwrap()).unwrap());
|
||||
|
||||
let read_key = |str| {
|
||||
let Ok(key) = std::env::var(str) else { None? };
|
||||
let Ok(key) = serai_env::var(str) else { None? };
|
||||
|
||||
let mut repr = <<Ristretto as Ciphersuite>::G as GroupEncoding>::Repr::default();
|
||||
repr.as_mut().copy_from_slice(&hex::decode(key).unwrap());
|
||||
|
||||
Reference in New Issue
Block a user