Beispiel #1
0
else:
    from configparser import ConfigParser

from kernel.logger import log
from kernel.commandline import options

conf = ConfigParser()
conf.optionxform = str

try:
    conf.read(options.pipeconf)

    # pipe settings
    conf.redisHost = conf.get("redis", "host")
    conf.redisPort = int(conf.get("redis", "port"))
    conf.redisPassword = conf.get("redis", "password")
    conf.amqpConnection = conf.get("amqp", "connection")
    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)
Beispiel #2
0
    # 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"))

    # amqp settings
    conf.amqpConnection = os.getenv(
        "AMQP_CONNECTION", conf.get("amqp", "connection"))

    # default settings if not set up previously
    if not conf.hostIp:
        from lib.ip import get_ip
        conf.hostIp = get_ip()

    if not conf.hostName:
        conf.hostName = conf.hostIp

    if not conf.environment:
        conf.environment = 'production'