From 5d6388b3665e611314e9b4842cb76c64de719a6f Mon Sep 17 00:00:00 2001 From: Lex Berezhny Date: Mon, 18 May 2020 08:13:29 -0400 Subject: [PATCH] added db_url to config --- lbry/conf.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/lbry/conf.py b/lbry/conf.py index b303d0fc9..85a7e7f0a 100644 --- a/lbry/conf.py +++ b/lbry/conf.py @@ -504,6 +504,8 @@ class CLIConfig(TranscodeConfig): class Config(CLIConfig): + db_url = String("Database connection URL, uses a local file based SQLite by default.") + # directories data_dir = Path("Directory path to store blobs.", metavar='DIR') download_dir = Path( @@ -619,10 +621,7 @@ class Config(CLIConfig): True ) - lbrycrd_dir = Path( - "Directory containing lbrycrd data.", - previous_names=['lbrycrd_dir'], metavar='DIR' - ) + lbrycrd_dir = Path("Directory containing lbrycrd data.", metavar='DIR') # daemon save_files = Toggle("Save downloaded files when calling `get` by default", True) @@ -688,6 +687,14 @@ class Config(CLIConfig): def log_file_path(self): return os.path.join(self.data_dir, 'lbrynet.log') + @property + def db_url_or_default(self): + if self.db_url: + return self.db_url + return 'sqlite://'+os.path.join( + self.data_dir, self.blockchain_name, 'blockchain.db' + ) + def get_windows_directories() -> typing.Tuple[str, str, str]: from lbry.winpaths import get_path, FOLDERID, UserHandle, \