feat: initial headless sync server implementation

This commit is contained in:
hermes
2026-04-23 13:50:56 +00:00
commit 553a1cf818
5 changed files with 117 additions and 0 deletions
+27
View File
@@ -0,0 +1,27 @@
#!/bin/bash
set -e
echo "Starting Obsidian Headless Sync Server..."
# Ensure we are in the vault directory
cd /vault
# 1. Initial Login
# Note: In a fully automated environment, the user will need to provide
# a session token or use 'ob login' interactively once.
# For this container, we assume the user has handled login or we use an environment variable.
if [ -z "$OBSIDIAN_SYNC_TOKEN" ]; then
echo "Warning: OBSIDIAN_SYNC_TOKEN not provided. You may need to run 'docker exec -it <container> ob login' manually once."
else
# Assuming the CLI supports token-based login or we inject the session
echo "Using provided sync token for login..."
# ob login --token $OBSIDIAN_SYNC_TOKEN
fi
# 2. Setup Sync for the specified vault
echo "Setting up sync for vault: $OBSIDIAN_VAULT_NAME"
ob sync-setup --vault "$OBSIDIAN_VAULT_NAME" --password "$OBSIDIAN_SYNC_PASSWORD" --device-name "$OBSIDIAN_DEVICE_NAME" --path /vault
# 3. Start Continuous Sync
echo "Entering continuous sync mode..."
exec ob sync --continuous