conf.hostName = conf.get("pipe", "hostname") conf.hostIp = conf.get("pipe", "hostip") if not conf.hostIp: from lib.ip import get_ip conf.hostIp = get_ip() if not conf.hostName: conf.hostName = conf.hostIp conf.environment = conf.get("pipe", "environment") if not conf.environment: conf.environment = 'production' except Exception as E: log.critical("Error reading " + options.pipeconf + ": %s", E) exit(1) try: conf.read(options.handlerconf) # server's base settings if options.port and (options.port != '0'): conf.port = int(options.port) else: conf.port = conf.getint("general", "port") conf.socketPacketLength = conf.getint("general", "socketPacketLength") conf.pathStorage = conf.get("general", "pathStorage") conf.pathTrash = conf.get("general", "pathTrash") except Exception as E: log.critical("Error reading " + options.handlerconf + ": %s", E) exit(1)
if sys.version_info < (3, 0): from ConfigParser import ConfigParser else: from configparser import ConfigParser from kernel.logger import log from kernel.options import options conf = ConfigParser() conf.optionxform = str try: conf.read(options.pipeconf) # pipe settings conf.socketPacketLength = conf.getint("pipe", "socketPacketLength") conf.environment = os.getenv( "PIPE_ENVIRONMENT", conf.get("pipe", "environment")) conf.hostName = os.getenv( "PIPE_HOSTNAME", conf.get("pipe", "hostname")) conf.hostIp = os.getenv( "PIPE_HOSTIP", conf.get("pipe", "hostip")) # redis settings conf.redisHost = os.getenv( "REDIS_HOST", conf.get("redis", "host")) conf.redisPort = int(os.getenv( "REDIS_PORT", conf.get("redis", "port"))) conf.redisPassword = os.getenv( "REDIS_PASS", conf.get("redis", "password"))