Skip to content

Commit

Permalink
Allow setting did:onion proxy URL
Browse files Browse the repository at this point in the history
  • Loading branch information
clehner authored Apr 21, 2022
1 parent 827ef18 commit bd620a1
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion lib/src/did_methods.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,20 @@ use std::env::VarError;

lazy_static! {
static ref DIDTZ: DIDTz = DIDTz::default();
static ref DIDONION: DIDOnion = DIDOnion::default();
static ref DIDONION: DIDOnion = {
let mut onion = DIDOnion::default();
if let Some(url) = match std::env::var("DID_ONION_PROXY_URL") {
Ok(url) => Some(url),
Err(VarError::NotPresent) => None,
Err(VarError::NotUnicode(err)) => {
eprintln!("Unable to parse DID_ONION_PROXY_URL: {:?}", err);
None
}
} {
onion.proxy_url = url;
}
onion
};
static ref ION: DIDION = DIDION::new(
match std::env::var("DID_ION_API_URL") {
Ok(string) => Some(string),
Expand Down

0 comments on commit bd620a1

Please sign in to comment.