# Path: opendiamond/protocol.py
# PORT = 5872


from builtins import object
from opendiamond.protocol import PORT
import logging
import os
import socket
import opendiamond
        path_specified = path is not None
        if not path_specified:
            try:
                path = os.path.join(os.environ['DIAMOND_CONFIG'],
                                    'diamond_config')
            except KeyError:
                try:
                    path = os.path.join(os.environ['HOME'], '.diamond',
                                        'diamond_config')
                except KeyError:
                    raise DiamondConfigError("Couldn't get location of "
                                             "diamond_config")
        confdir = os.path.dirname(path)

        # Determine the default number of diamondd worker threads.  On
        # Linux, the sysconf variable counts each hyperthread context as a
        # separate CPU, so this value may be too high.  In order to ensure
        # adequate testing of the multi-threaded case, never default to
        # fewer than two threads.
        try:
            default_threads = max(os.sysconf('SC_NPROCESSORS_ONLN'), 2)
        except OSError:
            default_threads = 2

        # Define configuration parameters
        params = _ConfigParams(
            # -- diamondd
            # Cache directory expiration
            _Param('blob_cache_days', 'BLOBDAYS', 30),
            # Redis database

# Path: opendiamond/protocol.py
# PORT = 5872


# Path: opendiamond/config.py
from builtins import object
from opendiamond.protocol import PORT
import logging
import os
import socket
import opendiamond

        path_specified = path is not None
        if not path_specified:
            try:
                path = os.path.join(os.environ['DIAMOND_CONFIG'],
                                    'diamond_config')
            except KeyError:
                try:
                    path = os.path.join(os.environ['HOME'], '.diamond',
                                        'diamond_config')
                except KeyError:
                    raise DiamondConfigError("Couldn't get location of "
                                             "diamond_config")
        confdir = os.path.dirname(path)

        # Determine the default number of diamondd worker threads.  On
        # Linux, the sysconf variable counts each hyperthread context as a
        # separate CPU, so this value may be too high.  In order to ensure
        # adequate testing of the multi-threaded case, never default to
        # fewer than two threads.
        try:
            default_threads = max(os.sysconf('SC_NPROCESSORS_ONLN'), 2)
        except OSError:
            default_threads = 2

        # Define configuration parameters
        params = _ConfigParams(
            # -- diamondd
            # Cache directory expiration
            _Param('blob_cache_days', 'BLOBDAYS', 30),
            # Redis database

            _Param('cache_database', 'CACHEDB', 0),