Skip to content

Commit 8b43df7

Browse files
authored
Merge pull request #2 from sqlrsync/matt
Merge Matt to Main
2 parents 6d8ce9a + d2818aa commit 8b43df7

9 files changed

Lines changed: 476 additions & 127 deletions

File tree

.github/workflows/build.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,11 @@ jobs:
1515
strategy:
1616
matrix:
1717
include:
18-
- os: windows
19-
runs-on: warp-windows-latest-2204-4x
18+
- os: darwin
19+
runs-on: macos-latest
20+
arch: arm64
21+
- os: linux
22+
runs-on: ubuntu-latest
2023
arch: amd64
2124

2225
steps:

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,6 @@
88

99
.claude/
1010
**/.claude/
11+
12+
CLAUDE.md
13+
**/CLAUDE.md

README.md

Lines changed: 60 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,67 @@ cd ../client; make build
1818

1919
Pre-compiled binaries for various platforms are available in the [releases](https://github.com/sqlrsync/client/releases) section of the GitHub repository.
2020

21-
* Mac (since 2020): sqlrsync-darwin-arm64
22-
* Mac (before 2020): sqlrsync-darwin-amd64
23-
* Linux: sqlrsync-linux-amd64
24-
* Windows: sqlrsync-windows-amd64.exe
21+
- Mac (since 2020): sqlrsync-darwin-arm64
22+
- Mac (before 2020): sqlrsync-darwin-amd64
23+
- Linux: sqlrsync-linux-amd64
24+
- Windows: sqlrsync-windows-amd64.exe
2525

2626
## Running
2727

2828
Run ./bin/sqlrsync <params>
29+
30+
## Application Logic and Settings
31+
32+
By default, REMOTE is SQLRsync.com Version Controlled Storage
33+
34+
### Authentication and Authorization
35+
36+
There are 3 types of keys used by SQLRsync:
37+
- Account Create: Allows the creation of a new Database on REMOTE
38+
- Account Pull: Allows creating a local copy of any version of any existing Database on REMOTE that is owned by that account
39+
- Replica Pull: Allows creating a local copy of any version of a specific existing Database on REMOTE to a local file
40+
- Replica Push: Allows the creation of a new version of a specific existing Database on REMOTE
41+
42+
Account level Pull and Create keys are never stored locally, and are always interactively prompted or provided as a command line argument.
43+
44+
If you use an Account level key, the server will reply with a new replica-specific Pull key (and Push token if you use an Account Create key). The pull key is stored adjacent to the replicated database in a file ending with the suffix `-sqlrsync`, along with other data. (For a database at /tmp/my-data.sqlite, the pull key would be stored in /tmp/my-data.sqlite-sqlrsync)
45+
46+
The more sensitive Replica Push key is stored in ~/.config/sqlrsync/local-secrets.toml and subsequent pushes will use that key.
47+
48+
### Stored Settings
49+
50+
Settings and defaults are stored in your user directory at ~/.config/sqlrsync. Within that directory, there are two files:
51+
52+
1. defaults.toml
53+
Contains default settings for all sqlrsync databases, like server URL, public/private, to generate a new unique clientSideEncryptionKey
54+
```toml
55+
# An example ~/.config/defaults.toml
56+
[defaults]
57+
server = "wss://sqlrsync.com"
58+
```
59+
cd
60+
2. local-secrets.toml
61+
Contains this-machine-specific settings, including the path to the local SQLite files, push keys, and encryption keys.
62+
63+
```toml
64+
# An example ~/.config/local-secrets.toml
65+
[local]
66+
# When a new SQLRsync Replica is created on the server, we can use this prefix to identify this machine
67+
hostname = "homelab3"
68+
defaultClientSideEncryptionKey = "riot-camel-pass-flash-cereal-journey"
69+
70+
[[sqlrsync-databases]]
71+
path = "/home/matt/webapps/hedgedoc/data/data.db"
72+
replicaID = "AJK928AK02jidsJA1"
73+
private-push-key = "abcd1234abcd1234"
74+
clientSideEncryptionKey = "riot-camel-pass-flash-cereal-journey"
75+
lastUpdated = "2023-01-01T00:00:00Z"
76+
server = "wss://s9.sqlrsync.com"
77+
78+
[[sqlrsync-databases]]
79+
path = "/home/matt/webapps/wikijs/data/another.db"
80+
private-push-key = "efgh5678efgh5678"
81+
lastUpdated = "2023-01-01T00:00:00Z"
82+
clientSideEncryptionKey = "riot-camel-pass-flash-cereal-journey"
83+
server = "wss://sqlrsync.com"
84+
```

bridge/cgo_bridge.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ func go_local_read_callback(userData unsafe.Pointer, buffer *C.uint8_t, size C.i
172172
bytesRead, err := client.ReadFunc(goBuffer)
173173
if err != nil {
174174
if err.Error() != "connection lost" && err.Error() != "sync completed" {
175-
client.Logger.Error("Read callback error", zap.Error(err))
175+
client.Logger.Error("Connection to server had a failure. Are you online? Read callback error", zap.Error(err))
176176
}
177177
return -1
178178
}

0 commit comments

Comments
 (0)