def parse_config_file():
    global CONFIG_FILE_CONTENTS
    try:
        CONFIG_FILE_CONTENTS
    except NameError:
        default_config = os.path.join(os.path.dirname(__file__), "config.conf")
        options = DotDict()
        options.configfile = default_config

        options.esservers = list(
            getConfig('esservers', 'http://localhost:9200',
                      options.configfile).split(','))

        options.alertExchange = getConfig('alertexchange', 'alerts',
                                          options.configfile)
        options.queueName = getConfig('alertqueuename', 'alertBot',
                                      options.configfile)
        options.alertqueue = getConfig('alertqueue', 'mozdef.alert',
                                       options.configfile)
        options.alerttopic = getConfig('alerttopic', 'mozdef.*',
                                       options.configfile)

        options.mquser = getConfig('mquser', 'guest', options.configfile)
        options.mqalertserver = getConfig('mqalertserver', 'localhost',
                                          options.configfile)
        options.mqserver = getConfig('mqserver', 'localhost',
                                     options.configfile)
        options.mqpassword = getConfig('mqpassword', 'guest',
                                       options.configfile)
        options.mqport = getConfig('mqport', 5672, options.configfile)
        options.mqack = getConfig('mqack', True, options.configfile)
        CONFIG_FILE_CONTENTS = options

    return CONFIG_FILE_CONTENTS
예제 #2
0
 def setup(self):
     sample_config = DotDict()
     sample_config.configfile = os.path.join(os.path.dirname(__file__), 'index.conf')
     OptionParser.parse_args = mock.Mock(return_value=(sample_config, {}))
     from loginput import index
     self.application = index.application
     super(LoginputTestSuite, self).setup()
예제 #3
0
def parse_config_file():
    global CONFIG_FILE_CONTENTS
    try:
        CONFIG_FILE_CONTENTS
    except NameError:
        default_config = os.path.join(os.path.dirname(__file__), "config.conf")
        options = DotDict()
        options.configfile = default_config

        options.esservers = list(getConfig('esservers', 'http://localhost:9200', options.configfile).split(','))

        options.alertExchange = getConfig('alertexchange', 'alerts', options.configfile)
        options.queueName = getConfig('alertqueuename', 'alertBot', options.configfile)
        options.alertqueue = getConfig('alertqueue', 'mozdef.alert', options.configfile)
        options.alerttopic = getConfig('alerttopic', 'mozdef.*', options.configfile)

        options.mquser = getConfig('mquser', 'guest', options.configfile)
        options.mqalertserver = getConfig('mqalertserver', 'localhost', options.configfile)
        options.mqserver = getConfig('mqserver', 'localhost', options.configfile)
        options.mqpassword = getConfig('mqpassword', 'guest', options.configfile)
        options.mqport = getConfig('mqport', 5672, options.configfile)
        options.mqack = getConfig('mqack', True, options.configfile)
        CONFIG_FILE_CONTENTS = options

    return CONFIG_FILE_CONTENTS
예제 #4
0
 def setup(self):
     sample_config = DotDict()
     sample_config.configfile = os.path.join(os.path.dirname(__file__),
                                             'index.conf')
     OptionParser.parse_args = mock.Mock(return_value=(sample_config, {}))
     from loginput import index as loginput_index
     self.application = loginput_index.application
     super().setup()
예제 #5
0
    def setup(self):
        sample_config = DotDict()
        sample_config.configfile = os.path.join(os.path.dirname(__file__),
                                                '../../rest/index.conf')
        OptionParser.parse_args = mock.Mock(return_value=(sample_config, {}))

        from rest import index
        self.application = index.application
        super(RestTestSuite, self).setup()