MCPcopy Create free account
hub / github.com/BitVM/BitVM / new

Method new

bridge/src/client/data_store/ftp/ftps.rs:22–55  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

20
21impl Ftps {
22 pub async fn new() -> Option<Self> {
23 dotenv::dotenv().ok();
24 let host = dotenv::var("BRIDGE_FTPS_HOST");
25 let port = dotenv::var("BRIDGE_FTPS_PORT");
26 let username = dotenv::var("BRIDGE_FTPS_USERNAME");
27 let password = dotenv::var("BRIDGE_FTPS_PASSWORD");
28 let base_path = dotenv::var("BRIDGE_FTPS_BASE_PATH");
29
30 if host.is_err()
31 || port.is_err()
32 || username.is_err()
33 || password.is_err()
34 || base_path.is_err()
35 {
36 return None;
37 }
38
39 let credentials = FtpCredentials {
40 is_secure: false,
41 host: host.unwrap(),
42 port: port.unwrap(),
43 username: username.unwrap(),
44 password: password.unwrap(),
45 base_path: base_path.unwrap(),
46 };
47
48 match lib::test_connection(&credentials).await {
49 Ok(_) => Some(Self { credentials }),
50 Err(err) => {
51 eprintln!("{err:?}");
52 None
53 }
54 }
55 }
56}
57
58#[async_trait]

Callers

nothing calls this directly

Calls 1

test_connectionFunction · 0.70

Tested by

no test coverage detected