Skip to content

Commit 49f8396

Browse files
authored
Add example for compiling exqlite with system installation (#62)
1 parent aecae72 commit 49f8396

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

README.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,32 @@ config :my_app, MyApp.Repo,
4343
database: "path/to/my/database.db",
4444
```
4545

46+
## Database Encryption
47+
48+
As of version 0.9, `exqlite` supports loading database engines at runtime rather than compiling `sqlite3.c` itself.
49+
This can be used to support database level encryption via alternate engines such as [SQLCipher](https://www.zetetic.net/sqlcipher/design)
50+
or the [Official SEE extension](https://www.sqlite.org/see/doc/trunk/www/readme.wiki). Once you have either of those projects installed
51+
on your system, use the following environment variables during compilation:
52+
53+
```bash
54+
# tell exqlite that we wish to use some other sqlite installation. this will prevent sqlite3.c and friends from compiling
55+
export EXQLITE_USE_SYSTEM=1
56+
57+
# Tell exqlite where to find the `sqlite3.h` file
58+
export EXQLITE_SYSTEM_CFLAGS=-I/usr/local/include/sqlcipher
59+
60+
# tell exqlite which sqlite implementation to use
61+
export EXQLITE_SYSTEM_LDFLAGS=-L/usr/local/lib -lsqlcipher
62+
```
63+
64+
Once you have `exqlite` configured, you can use the `:key` option in the database config to enable encryption:
65+
66+
```elixir
67+
config :my_app, MyApp.Repo,
68+
database: "path/to/my/encrypted-database.db",
69+
key: "super-secret'
70+
```
71+
4672
## Benchmarks
4773
4874
We have some benchmarks comparing it against the `MySQL` and `Postgres` adapters.

0 commit comments

Comments
 (0)