move settings into conf file
This commit is contained in:
parent
7076c0c870
commit
862055a6de
33 changed files with 39 additions and 38 deletions
|
@ -1,13 +1,6 @@
|
||||||
import logging
|
import logging
|
||||||
from conf import Config
|
|
||||||
|
|
||||||
__version__ = "0.6.9"
|
__version__ = "0.6.9"
|
||||||
version = tuple(__version__.split('.'))
|
version = tuple(__version__.split('.'))
|
||||||
|
|
||||||
# TODO: don't load the configuration automatically. The configuration
|
|
||||||
# should be loaded at runtime, not at module import time. Module
|
|
||||||
# import should have no side-effects. This is also bad because
|
|
||||||
# it means that settings are read from the environment even for
|
|
||||||
# tests, which is rarely what you want to happen.
|
|
||||||
settings = Config()
|
|
||||||
logging.getLogger(__name__).addHandler(logging.NullHandler())
|
logging.getLogger(__name__).addHandler(logging.NullHandler())
|
||||||
|
|
|
@ -5,7 +5,7 @@ import logging
|
||||||
from requests import auth
|
from requests import auth
|
||||||
from requests_futures import sessions
|
from requests_futures import sessions
|
||||||
|
|
||||||
from lbrynet import settings
|
from lbrynet.conf import settings
|
||||||
from lbrynet.analytics import utils
|
from lbrynet.analytics import utils
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -226,3 +226,11 @@ class Config(DefaultSettings):
|
||||||
@property
|
@property
|
||||||
def UI_ADDRESS(self):
|
def UI_ADDRESS(self):
|
||||||
return "http://%s:%i" % (DEFAULT_SETTINGS.API_INTERFACE, self.api_port)
|
return "http://%s:%i" % (DEFAULT_SETTINGS.API_INTERFACE, self.api_port)
|
||||||
|
|
||||||
|
|
||||||
|
# TODO: don't load the configuration automatically. The configuration
|
||||||
|
# should be loaded at runtime, not at module import time. Module
|
||||||
|
# import should have no side-effects. This is also bad because
|
||||||
|
# it means that settings are read from the environment even for
|
||||||
|
# tests, which is rarely what you want to happen.
|
||||||
|
settings = Config()
|
||||||
|
|
|
@ -8,7 +8,7 @@ from twisted.internet import interfaces, defer, threads
|
||||||
from twisted.protocols.basic import FileSender
|
from twisted.protocols.basic import FileSender
|
||||||
from twisted.python.failure import Failure
|
from twisted.python.failure import Failure
|
||||||
from zope.interface import implements
|
from zope.interface import implements
|
||||||
from lbrynet import settings
|
from lbrynet.conf import settings
|
||||||
from lbrynet.core.Error import DownloadCanceledError, InvalidDataError
|
from lbrynet.core.Error import DownloadCanceledError, InvalidDataError
|
||||||
from lbrynet.core.cryptoutils import get_lbry_hash_obj
|
from lbrynet.core.cryptoutils import get_lbry_hash_obj
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
from lbrynet.core.Strategy import get_default_strategy
|
from lbrynet.core.Strategy import get_default_strategy
|
||||||
from lbrynet import settings
|
from lbrynet.conf import settings
|
||||||
from decimal import Decimal
|
from decimal import Decimal
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@ from zope.interface import implementer
|
||||||
from decimal import Decimal
|
from decimal import Decimal
|
||||||
|
|
||||||
from lbrynet.interfaces import IBlobPriceModel
|
from lbrynet.interfaces import IBlobPriceModel
|
||||||
from lbrynet import settings
|
from lbrynet.conf import settings
|
||||||
|
|
||||||
|
|
||||||
def get_default_price_model(blob_tracker, base_price, **kwargs):
|
def get_default_price_model(blob_tracker, base_price, **kwargs):
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
from zope.interface import implementer
|
from zope.interface import implementer
|
||||||
from decimal import Decimal
|
from decimal import Decimal
|
||||||
from lbrynet import settings
|
from lbrynet.conf import settings
|
||||||
from lbrynet.interfaces import INegotiationStrategy
|
from lbrynet.interfaces import INegotiationStrategy
|
||||||
from lbrynet.core.Offer import Offer
|
from lbrynet.core.Offer import Offer
|
||||||
from lbrynet.core.PriceModel import MeanAvailabilityWeightedPrice
|
from lbrynet.core.PriceModel import MeanAvailabilityWeightedPrice
|
||||||
|
|
|
@ -4,7 +4,7 @@ from decimal import Decimal
|
||||||
from twisted.internet import error, defer
|
from twisted.internet import error, defer
|
||||||
from twisted.internet.protocol import Protocol, ClientFactory
|
from twisted.internet.protocol import Protocol, ClientFactory
|
||||||
from twisted.python import failure
|
from twisted.python import failure
|
||||||
from lbrynet import settings
|
from lbrynet.conf import settings
|
||||||
from lbrynet.core.Error import ConnectionClosedBeforeResponseError, NoResponseError
|
from lbrynet.core.Error import ConnectionClosedBeforeResponseError, NoResponseError
|
||||||
from lbrynet.core.Error import DownloadCanceledError, MisbehavingPeerError
|
from lbrynet.core.Error import DownloadCanceledError, MisbehavingPeerError
|
||||||
from lbrynet.core.Error import RequestCanceledError
|
from lbrynet.core.Error import RequestCanceledError
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
from lbrynet import settings
|
from lbrynet.conf import settings
|
||||||
|
|
||||||
|
|
||||||
class ClientRequest(object):
|
class ClientRequest(object):
|
||||||
|
|
|
@ -2,7 +2,7 @@ import logging
|
||||||
from twisted.internet import defer
|
from twisted.internet import defer
|
||||||
from zope.interface import implements
|
from zope.interface import implements
|
||||||
from lbrynet import interfaces
|
from lbrynet import interfaces
|
||||||
from lbrynet import settings
|
from lbrynet.conf import settings
|
||||||
from lbrynet.core.client.ClientProtocol import ClientProtocolFactory
|
from lbrynet.core.client.ClientProtocol import ClientProtocolFactory
|
||||||
from lbrynet.core.Error import InsufficientFundsError
|
from lbrynet.core.Error import InsufficientFundsError
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@ import traceback
|
||||||
from requests_futures.sessions import FuturesSession
|
from requests_futures.sessions import FuturesSession
|
||||||
|
|
||||||
import lbrynet
|
import lbrynet
|
||||||
from lbrynet import settings
|
from lbrynet.conf import settings
|
||||||
from lbrynet.core import utils
|
from lbrynet.core import utils
|
||||||
|
|
||||||
session = FuturesSession()
|
session = FuturesSession()
|
||||||
|
|
|
@ -8,7 +8,7 @@ import os
|
||||||
import socket
|
import socket
|
||||||
import yaml
|
import yaml
|
||||||
|
|
||||||
from lbrynet import settings
|
from lbrynet.conf import settings
|
||||||
from lbrynet.conf import AdjustableSettings
|
from lbrynet.conf import AdjustableSettings
|
||||||
from lbrynet.core.cryptoutils import get_lbry_hash_obj
|
from lbrynet.core.cryptoutils import get_lbry_hash_obj
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import binascii
|
import binascii
|
||||||
import logging
|
import logging
|
||||||
from Crypto.Cipher import AES
|
from Crypto.Cipher import AES
|
||||||
from lbrynet import settings
|
from lbrynet.conf import settings
|
||||||
from lbrynet.core.BlobInfo import BlobInfo
|
from lbrynet.core.BlobInfo import BlobInfo
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@ import logging
|
||||||
import os
|
import os
|
||||||
from lbrynet.core.StreamDescriptor import PlainStreamDescriptorWriter
|
from lbrynet.core.StreamDescriptor import PlainStreamDescriptorWriter
|
||||||
from lbrynet.cryptstream.CryptStreamCreator import CryptStreamCreator
|
from lbrynet.cryptstream.CryptStreamCreator import CryptStreamCreator
|
||||||
from lbrynet import settings
|
from lbrynet.conf import settings
|
||||||
from lbrynet.lbryfile.StreamDescriptor import get_sd_info
|
from lbrynet.lbryfile.StreamDescriptor import get_sd_info
|
||||||
from lbrynet.core.cryptoutils import get_lbry_hash_obj
|
from lbrynet.core.cryptoutils import get_lbry_hash_obj
|
||||||
from twisted.protocols.basic import FileSender
|
from twisted.protocols.basic import FileSender
|
||||||
|
|
|
@ -6,7 +6,7 @@ from lbrynet.core.cryptoutils import get_lbry_hash_obj, get_pub_key, sign_with_p
|
||||||
from Crypto import Random
|
from Crypto import Random
|
||||||
import binascii
|
import binascii
|
||||||
import logging
|
import logging
|
||||||
from lbrynet import settings
|
from lbrynet.conf import settings
|
||||||
from twisted.internet import interfaces, defer
|
from twisted.internet import interfaces, defer
|
||||||
from twisted.protocols.basic import FileSender
|
from twisted.protocols.basic import FileSender
|
||||||
from zope.interface import implements
|
from zope.interface import implements
|
||||||
|
|
|
@ -3,7 +3,7 @@ import logging
|
||||||
from zope.interface import implements
|
from zope.interface import implements
|
||||||
from twisted.internet import defer
|
from twisted.internet import defer
|
||||||
from twisted.python.failure import Failure
|
from twisted.python.failure import Failure
|
||||||
from lbrynet import settings
|
from lbrynet.conf import settings
|
||||||
from lbrynet.core.client.ClientRequest import ClientRequest, ClientPaidRequest
|
from lbrynet.core.client.ClientRequest import ClientRequest, ClientPaidRequest
|
||||||
from lbrynet.lbrylive.LiveBlob import LiveBlobInfo
|
from lbrynet.lbrylive.LiveBlob import LiveBlobInfo
|
||||||
from lbrynet.core.cryptoutils import get_lbry_hash_obj, verify_signature
|
from lbrynet.core.cryptoutils import get_lbry_hash_obj, verify_signature
|
||||||
|
|
|
@ -19,7 +19,7 @@ from lbrynet.core.Session import Session
|
||||||
from lbrynet.lbrynet_console.ConsoleControl import ConsoleControl
|
from lbrynet.lbrynet_console.ConsoleControl import ConsoleControl
|
||||||
from lbrynet.lbrynet_console.Settings import Settings
|
from lbrynet.lbrynet_console.Settings import Settings
|
||||||
from lbrynet.lbryfilemanager.EncryptedFileManager import EncryptedFileManager
|
from lbrynet.lbryfilemanager.EncryptedFileManager import EncryptedFileManager
|
||||||
from lbrynet import settings
|
from lbrynet.conf import settings
|
||||||
from lbrynet.core.utils import generate_id
|
from lbrynet.core.utils import generate_id
|
||||||
from lbrynet.core.StreamDescriptor import StreamDescriptorIdentifier
|
from lbrynet.core.StreamDescriptor import StreamDescriptorIdentifier
|
||||||
from lbrynet.core.PaymentRateManager import PaymentRateManager
|
from lbrynet.core.PaymentRateManager import PaymentRateManager
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
from lbrynet.lbrynet_console import Plugin
|
from lbrynet.lbrynet_console import Plugin
|
||||||
from twisted.internet import defer
|
from twisted.internet import defer
|
||||||
from lbrynet import settings
|
from lbrynet.conf import settings
|
||||||
from BlindRepeater import BlindRepeater
|
from BlindRepeater import BlindRepeater
|
||||||
from BlindInfoManager import BlindInfoManager
|
from BlindInfoManager import BlindInfoManager
|
||||||
from BlindRepeaterSettings import BlindRepeaterSettings
|
from BlindRepeaterSettings import BlindRepeaterSettings
|
||||||
|
|
|
@ -26,7 +26,7 @@ from lbrynet import __version__ as lbrynet_version
|
||||||
from lbryum.version import LBRYUM_VERSION as lbryum_version
|
from lbryum.version import LBRYUM_VERSION as lbryum_version
|
||||||
|
|
||||||
from lbrynet import __version__ as lbrynet_version
|
from lbrynet import __version__ as lbrynet_version
|
||||||
from lbrynet import settings as lbrynet_settings
|
from lbrynet.conf import settings as lbrynet_settings
|
||||||
from lbrynet import analytics
|
from lbrynet import analytics
|
||||||
from lbrynet import reflector
|
from lbrynet import reflector
|
||||||
from lbrynet.metadata.Metadata import Metadata, verify_name_characters
|
from lbrynet.metadata.Metadata import Metadata, verify_name_characters
|
||||||
|
|
|
@ -2,7 +2,7 @@ import sys
|
||||||
import json
|
import json
|
||||||
import argparse
|
import argparse
|
||||||
|
|
||||||
from lbrynet import settings
|
from lbrynet.conf import settings
|
||||||
from lbrynet.lbrynet_daemon.auth.client import LBRYAPIClient
|
from lbrynet.lbrynet_daemon.auth.client import LBRYAPIClient
|
||||||
|
|
||||||
help_msg = "Usage: lbrynet-cli method json-args\n" \
|
help_msg = "Usage: lbrynet-cli method json-args\n" \
|
||||||
|
|
|
@ -16,7 +16,7 @@ from lbrynet.core import log_support
|
||||||
from lbrynet.core import utils
|
from lbrynet.core import utils
|
||||||
from lbrynet.lbrynet_daemon.DaemonServer import DaemonServer
|
from lbrynet.lbrynet_daemon.DaemonServer import DaemonServer
|
||||||
from lbrynet.lbrynet_daemon.DaemonRequest import DaemonRequest
|
from lbrynet.lbrynet_daemon.DaemonRequest import DaemonRequest
|
||||||
from lbrynet import settings
|
from lbrynet.conf import settings
|
||||||
|
|
||||||
log_dir = settings.data_dir
|
log_dir = settings.data_dir
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@ from appdirs import user_data_dir
|
||||||
from twisted.internet import defer
|
from twisted.internet import defer
|
||||||
from lbrynet.lbrynet_daemon.Daemon import Daemon
|
from lbrynet.lbrynet_daemon.Daemon import Daemon
|
||||||
from lbrynet.lbrynet_daemon.Resources import LBRYindex, HostedEncryptedFile, EncryptedFileUpload
|
from lbrynet.lbrynet_daemon.Resources import LBRYindex, HostedEncryptedFile, EncryptedFileUpload
|
||||||
from lbrynet import settings
|
from lbrynet.conf import settings
|
||||||
|
|
||||||
|
|
||||||
# TODO: omg, this code is essentially duplicated in Daemon
|
# TODO: omg, this code is essentially duplicated in Daemon
|
||||||
|
|
|
@ -12,7 +12,7 @@ from lbrynet.core.Error import InsufficientFundsError, KeyFeeAboveMaxAllowed
|
||||||
from lbrynet.core.StreamDescriptor import download_sd_blob
|
from lbrynet.core.StreamDescriptor import download_sd_blob
|
||||||
from lbrynet.metadata.Fee import FeeValidator
|
from lbrynet.metadata.Fee import FeeValidator
|
||||||
from lbrynet.lbryfilemanager.EncryptedFileDownloader import ManagedEncryptedFileDownloaderFactory
|
from lbrynet.lbryfilemanager.EncryptedFileDownloader import ManagedEncryptedFileDownloaderFactory
|
||||||
from lbrynet import settings
|
from lbrynet.conf import settings
|
||||||
|
|
||||||
INITIALIZING_CODE = 'initializing'
|
INITIALIZING_CODE = 'initializing'
|
||||||
DOWNLOAD_METADATA_CODE = 'downloading_metadata'
|
DOWNLOAD_METADATA_CODE = 'downloading_metadata'
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import logging
|
import logging
|
||||||
import random
|
import random
|
||||||
from txjsonrpc.web.jsonrpc import Proxy
|
from txjsonrpc.web.jsonrpc import Proxy
|
||||||
from lbrynet import settings
|
from lbrynet.conf import settings
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,7 @@ from lbrynet.lbryfile.StreamDescriptor import publish_sd_blob
|
||||||
from lbrynet.metadata.Metadata import Metadata
|
from lbrynet.metadata.Metadata import Metadata
|
||||||
from lbrynet.lbryfilemanager.EncryptedFileDownloader import ManagedEncryptedFileDownloader
|
from lbrynet.lbryfilemanager.EncryptedFileDownloader import ManagedEncryptedFileDownloader
|
||||||
from lbrynet import reflector
|
from lbrynet import reflector
|
||||||
from lbrynet import settings
|
from lbrynet.conf import settings
|
||||||
from twisted.internet import threads, defer, reactor
|
from twisted.internet import threads, defer, reactor
|
||||||
|
|
||||||
if sys.platform != "darwin":
|
if sys.platform != "darwin":
|
||||||
|
|
|
@ -10,7 +10,7 @@ from appdirs import user_data_dir
|
||||||
from twisted.web import server, static, resource
|
from twisted.web import server, static, resource
|
||||||
from twisted.internet import defer, error
|
from twisted.internet import defer, error
|
||||||
|
|
||||||
from lbrynet import settings
|
from lbrynet.conf import settings
|
||||||
from lbrynet.lbrynet_daemon.FileStreamer import EncryptedFileStreamer
|
from lbrynet.lbrynet_daemon.FileStreamer import EncryptedFileStreamer
|
||||||
|
|
||||||
# TODO: omg, this code is essentially duplicated in Daemon
|
# TODO: omg, this code is essentially duplicated in Daemon
|
||||||
|
|
|
@ -8,7 +8,7 @@ from urllib2 import urlopen
|
||||||
from StringIO import StringIO
|
from StringIO import StringIO
|
||||||
from twisted.internet import defer
|
from twisted.internet import defer
|
||||||
from twisted.internet.task import LoopingCall
|
from twisted.internet.task import LoopingCall
|
||||||
from lbrynet import settings
|
from lbrynet.conf import settings
|
||||||
from lbrynet.lbrynet_daemon.Resources import NoCacheStaticFile
|
from lbrynet.lbrynet_daemon.Resources import NoCacheStaticFile
|
||||||
from lbrynet import __version__ as lbrynet_version
|
from lbrynet import __version__ as lbrynet_version
|
||||||
from lbryum.version import LBRYUM_VERSION as lbryum_version
|
from lbryum.version import LBRYUM_VERSION as lbryum_version
|
||||||
|
|
|
@ -6,7 +6,7 @@ import base64
|
||||||
import json
|
import json
|
||||||
|
|
||||||
from lbrynet.lbrynet_daemon.auth.util import load_api_keys, APIKey, API_KEY_NAME, get_auth_message
|
from lbrynet.lbrynet_daemon.auth.util import load_api_keys, APIKey, API_KEY_NAME, get_auth_message
|
||||||
from lbrynet import settings
|
from lbrynet.conf import settings
|
||||||
from jsonrpc.proxy import JSONRPCProxy
|
from jsonrpc.proxy import JSONRPCProxy
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
|
@ -7,7 +7,7 @@ from twisted.internet import defer
|
||||||
from txjsonrpc import jsonrpclib
|
from txjsonrpc import jsonrpclib
|
||||||
|
|
||||||
from lbrynet.core.Error import InvalidAuthenticationToken, InvalidHeaderError, SubhandlerError
|
from lbrynet.core.Error import InvalidAuthenticationToken, InvalidHeaderError, SubhandlerError
|
||||||
from lbrynet import settings
|
from lbrynet.conf import settings
|
||||||
from lbrynet.lbrynet_daemon.auth.util import APIKey, get_auth_message
|
from lbrynet.lbrynet_daemon.auth.util import APIKey, get_auth_message
|
||||||
from lbrynet.lbrynet_daemon.auth.client import LBRY_SECRET
|
from lbrynet.lbrynet_daemon.auth.client import LBRY_SECRET
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
from lbrynet import settings
|
from lbrynet.conf import settings
|
||||||
|
|
||||||
from twisted.web.client import Agent, FileBodyProducer, Headers, ResponseDone
|
from twisted.web.client import Agent, FileBodyProducer, Headers, ResponseDone
|
||||||
from twisted.internet import threads, defer, protocol
|
from twisted.internet import threads, defer, protocol
|
||||||
|
|
|
@ -11,7 +11,7 @@ import unittest
|
||||||
from Crypto.PublicKey import RSA
|
from Crypto.PublicKey import RSA
|
||||||
from Crypto import Random
|
from Crypto import Random
|
||||||
from Crypto.Hash import MD5
|
from Crypto.Hash import MD5
|
||||||
from lbrynet import settings
|
from lbrynet.conf import settings
|
||||||
from lbrynet.lbrylive.LiveStreamCreator import FileLiveStreamCreator
|
from lbrynet.lbrylive.LiveStreamCreator import FileLiveStreamCreator
|
||||||
from lbrynet.lbrylive.LiveStreamMetadataManager import DBLiveStreamMetadataManager
|
from lbrynet.lbrylive.LiveStreamMetadataManager import DBLiveStreamMetadataManager
|
||||||
from lbrynet.lbrylive.LiveStreamMetadataManager import TempLiveStreamMetadataManager
|
from lbrynet.lbrylive.LiveStreamMetadataManager import TempLiveStreamMetadataManager
|
||||||
|
|
|
@ -4,7 +4,7 @@ import shutil
|
||||||
from twisted.internet import defer, threads, error
|
from twisted.internet import defer, threads, error
|
||||||
from twisted.trial import unittest
|
from twisted.trial import unittest
|
||||||
|
|
||||||
from lbrynet import settings
|
from lbrynet.conf import settings
|
||||||
from lbrynet import lbryfile
|
from lbrynet import lbryfile
|
||||||
from lbrynet import reflector
|
from lbrynet import reflector
|
||||||
from lbrynet.core import BlobManager
|
from lbrynet.core import BlobManager
|
||||||
|
|
|
@ -6,7 +6,7 @@ from Crypto.Hash import MD5
|
||||||
from twisted.trial.unittest import TestCase
|
from twisted.trial.unittest import TestCase
|
||||||
from twisted.internet import defer, threads
|
from twisted.internet import defer, threads
|
||||||
|
|
||||||
from lbrynet import settings
|
from lbrynet.conf import settings
|
||||||
from lbrynet.lbryfile.EncryptedFileMetadataManager import TempEncryptedFileMetadataManager
|
from lbrynet.lbryfile.EncryptedFileMetadataManager import TempEncryptedFileMetadataManager
|
||||||
from lbrynet.lbryfile.EncryptedFileMetadataManager import DBEncryptedFileMetadataManager
|
from lbrynet.lbryfile.EncryptedFileMetadataManager import DBEncryptedFileMetadataManager
|
||||||
from lbrynet.lbryfilemanager.EncryptedFileManager import EncryptedFileManager
|
from lbrynet.lbryfilemanager.EncryptedFileManager import EncryptedFileManager
|
||||||
|
|
Loading…
Add table
Reference in a new issue