Skip to content

Commit e1eaf3b

Browse files
authored
libsql: fix replica example (#1070)
1 parent a046bac commit e1eaf3b

1 file changed

Lines changed: 15 additions & 8 deletions

File tree

libsql/examples/replica.rs

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,22 @@ async fn main() {
2020
})
2121
.replace("libsql", "https");
2222

23-
let encryption_config = EncryptionConfig {
24-
cipher: Cipher::Aes256Cbc,
25-
encryption_key: "s3cr3t".into(),
23+
let db = if cfg!(feature = "encryption") {
24+
let encryption_config = EncryptionConfig {
25+
cipher: Cipher::Aes256Cbc,
26+
encryption_key: "s3cr3t".into(),
27+
};
28+
Builder::new_remote_replica(db_file.path(), url, auth_token)
29+
.encryption_config(encryption_config)
30+
.build()
31+
.await
32+
.unwrap()
33+
} else {
34+
Builder::new_remote_replica(db_file.path(), url, auth_token)
35+
.build()
36+
.await
37+
.unwrap()
2638
};
27-
let db = Builder::new_remote_replica(db_file.path(), url, auth_token)
28-
.encryption_config(encryption_config)
29-
.build()
30-
.await
31-
.unwrap();
3239

3340
let conn = db.connect().unwrap();
3441

0 commit comments

Comments
 (0)