Skip to content

Commit

Permalink
libsql: fix replica example (#1070)
Browse files Browse the repository at this point in the history
  • Loading branch information
LucioFranco authored Feb 21, 2024
1 parent a046bac commit e1eaf3b
Showing 1 changed file with 15 additions and 8 deletions.
23 changes: 15 additions & 8 deletions libsql/examples/replica.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,22 @@ async fn main() {
})
.replace("libsql", "https");

let encryption_config = EncryptionConfig {
cipher: Cipher::Aes256Cbc,
encryption_key: "s3cr3t".into(),
let db = if cfg!(feature = "encryption") {
let encryption_config = EncryptionConfig {
cipher: Cipher::Aes256Cbc,
encryption_key: "s3cr3t".into(),
};
Builder::new_remote_replica(db_file.path(), url, auth_token)
.encryption_config(encryption_config)
.build()
.await
.unwrap()
} else {
Builder::new_remote_replica(db_file.path(), url, auth_token)
.build()
.await
.unwrap()
};
let db = Builder::new_remote_replica(db_file.path(), url, auth_token)
.encryption_config(encryption_config)
.build()
.await
.unwrap();

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

Expand Down

0 comments on commit e1eaf3b

Please sign in to comment.