From 6d7608d85123c7c0a8c5cfa81c0dad307774ff5b Mon Sep 17 00:00:00 2001 From: Alex Liebowitz Date: Mon, 4 Jul 2016 16:16:34 -0400 Subject: [PATCH] Create lbrycrd.conf if needed --- lbrynet/lbrynet_daemon/LBRYDaemon.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/lbrynet/lbrynet_daemon/LBRYDaemon.py b/lbrynet/lbrynet_daemon/LBRYDaemon.py index 7549863ce..f73c0eb35 100644 --- a/lbrynet/lbrynet_daemon/LBRYDaemon.py +++ b/lbrynet/lbrynet_daemon/LBRYDaemon.py @@ -1,8 +1,10 @@ +import string import locale import mimetypes import os import subprocess import sys +import random import simplejson as json import binascii import logging.handlers @@ -328,6 +330,17 @@ class LBRYDaemon(jsonrpc.JSONRPC): self.lbry_file_metadata_manager = None self.lbry_file_manager = None + if self.wallet_type == "lbrycrd": + if os.path.isfile(self.lbrycrd_conf): + log.info("Using lbrycrd.conf found at " + self.lbrycrd_conf) + else: + log.info("No lbrycrd.conf found at " + self.lbrycrd_conf + ". Generating now...") + password = "".join(random.SystemRandom().choice(string.ascii_letters + string.digits + "_") for i in range(20)) + with open(self.lbrycrd_conf, 'w') as f: + f.write("rpcuser=rpcuser\n") + f.write("rpcpassword=" + password) + log.info("Done writing lbrycrd.conf") + def render(self, request): request.content.seek(0, 0) # Unmarshal the JSON-RPC data.