forked from LBRYCommunity/lbry-sdk
Create lbrycrd.conf if needed
This commit is contained in:
parent
8c3652e1ac
commit
6d7608d851
1 changed files with 13 additions and 0 deletions
|
@ -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.
|
||||
|
|
Loading…
Reference in a new issue