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

Method new

bridge/src/client/data_store/ftp/ftp.rs:20–53  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 1

test_connectionFunction · 0.70

Tested by

no test coverage detected