Skip to content

Commit 0ea8b47

Browse files
committed
Add documentation about using system install sqlite3 instead
1 parent 673c953 commit 0ea8b47

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed

README.md

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,51 @@ config :exqlite, default_chunk_size: 100
4848
not specifying the chunk size explicitly.
4949

5050

51+
## Advanced Configuration
52+
53+
### Using System Installed Libraries
54+
55+
This will vary depending on the operating system.
56+
57+
```bash
58+
# tell exqlite that we wish to use some other sqlite installation. this will prevent sqlite3.c and friends from compiling
59+
export EXQLITE_USE_SYSTEM=1
60+
61+
# Tell exqlite where to find the `sqlite3.h` file
62+
export EXQLITE_SYSTEM_CFLAGS=-I/usr/include
63+
64+
# tell exqlite which sqlite implementation to use
65+
export EXQLITE_SYSTEM_LDFLAGS=-L/lib -lsqlite3
66+
```
67+
68+
After exporting those variables you can then invoke `mix deps.compile`. Note if you
69+
re-export those values, you will need to recompile the `exqlite` dependency in order to
70+
pickup those changes.
71+
72+
### Database Encryption
73+
74+
As of version 0.9, `exqlite` supports loading database engines at runtime rather than compiling `sqlite3.c` itself.
75+
This can be used to support database level encryption via alternate engines such as [SQLCipher](https://www.zetetic.net/sqlcipher/design)
76+
or the [Official SEE extension](https://www.sqlite.org/see/doc/trunk/www/readme.wiki). Once you have either of those projects installed
77+
on your system, use the following environment variables during compilation:
78+
79+
```bash
80+
# tell exqlite that we wish to use some other sqlite installation. this will prevent sqlite3.c and friends from compiling
81+
export EXQLITE_USE_SYSTEM=1
82+
83+
# Tell exqlite where to find the `sqlite3.h` file
84+
export EXQLITE_SYSTEM_CFLAGS=-I/usr/local/include/sqlcipher
85+
86+
# tell exqlite which sqlite implementation to use
87+
export EXQLITE_SYSTEM_LDFLAGS=-L/usr/local/lib -lsqlcipher
88+
```
89+
90+
Once you have `exqlite` configured, you can use the `:key` option in the database config to enable encryption:
91+
92+
```elixir
93+
config :exqlite, key: "super-secret'
94+
```
95+
5196
## Usage
5297
5398
The `Exqlite.Sqlite3` module usage is fairly straight forward.

0 commit comments

Comments
 (0)