def setup_descriptions(self):
     staticconf.get('one', help="the one")
     staticconf.get_time('when', default='NOW', help="The time")
     staticconf.get_bool('you sure', default='No', help='Are you?')
     staticconf.get('one', help="the one", namespace='Beta')
     staticconf.get('one', help="the one", namespace='Alpha')
     staticconf.get('two', help="the two", namespace='Alpha')
 def setup_descriptions(self):
     staticconf.get('one', help="the one")
     staticconf.get_time('when', default='NOW', help="The time")
     staticconf.get_bool('you sure', default='No', help='Are you?')
     staticconf.get('one', help="the one", namespace='Beta')
     staticconf.get('one', help="the one", namespace='Alpha')
     staticconf.get('two', help="the two", namespace='Alpha')
Esempio n. 3
0
    def force_exit(self):
        """Determines if we should force an exit, which can be helpful if we'd
        otherwise block waiting for replication events that aren't going to come.

        In general, this should be False in prod environments, and True in test
        environments.
        """
        return staticconf.get_bool('force_exit').value
Esempio n. 4
0
 def activate_mysql_dump_recovery(self):
     """Determines the recovery mechanism. When set to true, will use the
     mysql dumps to recover during a failure.
     Defaults to false which uses journaling for recovery
     """
     return staticconf.get_bool(
         'activate_mysql_dump_recovery',
         default=False
     ).value
Esempio n. 5
0
    def test_mock_configuration(self):
        two = staticconf.get_string('two')
        stars = staticconf.get_bool('stars')

        mock_config = testing.MockConfiguration(dict(two=2, stars=False))
        mock_config.setup()
        assert_equal(two, '2')
        assert not stars
        mock_config.teardown()
        assert_raises(errors.ConfigurationError, staticconf.get('two'))
 def test_load_and_validate(self):
     staticconf.DictConfiguration(self.config)
     some_class = SomeClass()
     assert_equal(some_class.max, 100)
     assert_equal(some_class.min, 0)
     assert_equal(some_class.ratio, 7.7)
     assert_equal(some_class.alt_ratio, 6.0)
     assert_equal(staticconf.get("globals"), False)
     assert_equal(staticconf.get("enable"), "True")
     assert_equal(staticconf.get_bool("enable"), True)
Esempio n. 7
0
    def resume_stream(self):
        """Controls if the replication handler will attempt to resume from
        an existing position, or start from the beginning of replicaton.  This
        should almost always be True.  The two exceptions are when dealing
        with a brand new database that has never had any tables created, or
        when running integration tests.

        We may want to make this always True, and otherwise bootstrap the
        replication handler for integration tests.  Even "schemaless" databases
        likely have Yelp administrative tables, limiting the usefuleness of
        this in practice.
        """
        return staticconf.get_bool('resume_stream', default=True).value
Esempio n. 8
0
 def test_load_and_validate(self):
     staticconf.DictConfiguration(self.config)
     some_class = SomeClass()
     assert_equal(some_class.max, 100)
     assert_equal(some_class.min, 0)
     assert_equal(some_class.ratio, 7.7)
     assert_equal(some_class.alt_ratio, 6.0)
     assert_equal(staticconf.get('globals'), False)
     assert_equal(staticconf.get('enable'), 'True')
     assert_equal(staticconf.get_bool('enable'), True)
     assert_equal(some_class.msg, None)
     assert staticconf.get_regex('matcher').match('12345')
     assert not staticconf.get_regex('matcher').match('a')
     assert_equal(staticconf.get_list_of_int('options'), [1, 7, 3, 9])
Esempio n. 9
0
from __future__ import absolute_import

import os

import staticconf

CONFIG_PATH = "config.yaml"

db_uri = staticconf.get_string('db_uri')
secret_key = staticconf.get_string('secret_key')
debug = staticconf.get_bool('debug', False)

user_blacklist = staticconf.get_list('user_blacklist', [])


def load():
    if os.path.exists(CONFIG_PATH):
        staticconf.YamlConfiguration(CONFIG_PATH, error_on_unknown=True)
Esempio n. 10
0
 def gtid_enabled(self):
     """This configuration decides if replicatin handler uses GTID or heartbeat.
     Currently GTID is supported in mysql 5.6 and above only.
     """
     return staticconf.get_bool('gtid_enabled', default=False).value