Fix Obsidian sync setup in Docker by running login and sync-setup before sync
Replace OBSIDIAN_AUTH_TOKEN with OBSIDIAN_EMAIL/OBSIDIAN_PASSWORD and run the full ob login → sync-setup → sync sequence on container startup so fresh containers authenticate properly instead of failing with "Run 'ob sync-setup' first". Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
+19
-2
@@ -8,8 +8,25 @@ mkdir -p /app/data/obsidian
|
||||
|
||||
# Start continuous Obsidian sync if enabled
|
||||
if [ "${OBSIDIAN_CONTINUOUS_SYNC}" = "true" ]; then
|
||||
echo "Starting Obsidian continuous sync in background..."
|
||||
ob sync --continuous &
|
||||
echo "Setting up Obsidian sync..."
|
||||
|
||||
VAULT_PATH="${OBSIDIAN_VAULT_PATH:-/app/data/obsidian}"
|
||||
|
||||
# Login
|
||||
ob login --email "${OBSIDIAN_EMAIL}" --password "${OBSIDIAN_PASSWORD}" && \
|
||||
# Setup sync for vault
|
||||
ob sync-setup \
|
||||
--vault "${OBSIDIAN_VAULT_ID}" \
|
||||
--path "${VAULT_PATH}" \
|
||||
--password "${OBSIDIAN_E2E_PASSWORD}" \
|
||||
--device-name "${OBSIDIAN_DEVICE_NAME:-simbarag}" && \
|
||||
# Start continuous sync in background
|
||||
echo "Starting Obsidian continuous sync..." && \
|
||||
ob sync --continuous --path "${VAULT_PATH}" &
|
||||
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "WARNING: Obsidian sync setup failed. Continuing without sync."
|
||||
fi
|
||||
fi
|
||||
|
||||
echo "Starting application..."
|
||||
|
||||
Reference in New Issue
Block a user