Create lbrycrd.conf if needed

This commit is contained in:
Alex Liebowitz 2016-07-04 16:16:34 -04:00
parent 8c3652e1ac
commit 6d7608d851

View file

@ -1,8 +1,10 @@
import string
import locale import locale
import mimetypes import mimetypes
import os import os
import subprocess import subprocess
import sys import sys
import random
import simplejson as json import simplejson as json
import binascii import binascii
import logging.handlers import logging.handlers
@ -328,6 +330,17 @@ class LBRYDaemon(jsonrpc.JSONRPC):
self.lbry_file_metadata_manager = None self.lbry_file_metadata_manager = None
self.lbry_file_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): def render(self, request):
request.content.seek(0, 0) request.content.seek(0, 0)
# Unmarshal the JSON-RPC data. # Unmarshal the JSON-RPC data.