A simple electerm data sync server.
macOS (with Homebrew):
brew install cmake boost asio sqlite3Ubuntu/Debian:
sudo apt update
sudo apt install cmake libboost-all-dev libasio-dev libssl-dev libsqlite3-devCentOS/RHEL/Fedora:
sudo yum install cmake boost-devel asio-devel openssl-devel sqlite-devel # CentOS/RHEL
# or
sudo dnf install cmake boost-devel asio-devel openssl-devel sqlite-devel # FedoraThe project uses Crow (web framework) and jwt-cpp headers, which are downloaded automatically.
git clone git@github.com:electerm/electerm-sync-server-cpp.git
cd electerm-sync-server-cpp
# create env file, then edit .env
cp sample.env .env
# Edit .env to set your JWT_SECRET and JWT_USERS
# download project dependencies (Crow and jwt-cpp headers)
./scripts/init
# build the project
./scripts/build
# run the server
./scripts/runThe server will start and show something like:
server running at http://127.0.0.1:7837
Edit the .env file to configure:
PORT: Server port (default: 7837)HOST: Server host (default: 127.0.0.1)JWT_SECRET: Secret key for JWT tokens (change in production!)JWT_USERS: Comma-separated list of allowed usernamesFILE_STORE_PATH: Optional path for data storage (defaults to current directory)
In electerm sync settings, set custom sync server with:
- Server URL:
http://127.0.0.1:7837 - JWT_SECRET: Your JWT_SECRET from
.env - JWT_USER_NAME: One of the JWT_USERS from
.env
GET /api/sync- Retrieve user data (requires JWT auth)POST /api/sync- Test endpoint (requires JWT auth)PUT /api/sync- Store user data (requires JWT auth)GET /test- Health check endpoint
./scripts/testTake src/data_store.hpp as an example to implement your own read/write methods.
https://github.com/electerm/electerm/wiki/Custom-sync-server
MIT