mirror of
https://github.com/aljazceru/plugins.git
synced 2026-01-05 22:34:20 +01:00
backend: Use th backup URL in backup-cli and add snapshot type to FileBackend
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env python3
|
||||
from backup import FileBackend
|
||||
from backup import FileBackend, get_backend
|
||||
import os
|
||||
import click
|
||||
import json
|
||||
@@ -7,10 +7,10 @@ import json
|
||||
|
||||
@click.command()
|
||||
@click.argument("lightning-dir", type=click.Path(exists=True))
|
||||
@click.argument("backup-dir", type=click.Path(exists=True))
|
||||
def init(lightning_dir, backup_dir):
|
||||
destination = 'file://' + os.path.join(backup_dir, 'backup.dbak')
|
||||
backend = FileBackend(destination)
|
||||
@click.argument("backend-url")
|
||||
def init(lightning_dir, backend_url):
|
||||
destination = backend_url
|
||||
backend = get_backend(destination)
|
||||
backend.version, backend.prev_version = 0, 0
|
||||
backend.offsets = [512, 0]
|
||||
backend.version_count = 0
|
||||
@@ -23,6 +23,8 @@ def init(lightning_dir, backup_dir):
|
||||
'backend_url': destination,
|
||||
}))
|
||||
|
||||
# TODO Take a snapshot
|
||||
|
||||
print("Initialized backup backend {destination}, you can now start c-lightning".format(
|
||||
destination=destination,
|
||||
))
|
||||
|
||||
Reference in New Issue
Block a user