diff --git a/MANIFEST.in b/MANIFEST.in index 0f66338..b877f8c 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,6 +1,7 @@ include man/man1/isso.1 include man/man5/isso.conf.5 +include isso/defaults.ini include share/isso.conf include isso/js/embed.min.js diff --git a/isso/__init__.py b/isso/__init__.py index 7890118..6a85c88 100644 --- a/isso/__init__.py +++ b/isso/__init__.py @@ -220,7 +220,7 @@ def main(): serve = subparser.add_parser("run", help="run server") args = parser.parse_args() - conf = config.load(join(dist.location, "share", "isso.conf"), args.conf) + conf = config.load(join(dist.location, "isso", "defaults.ini"), args.conf) if args.command == "import": conf.set("guard", "enabled", "off") diff --git a/isso/defaults.ini b/isso/defaults.ini new file mode 120000 index 0000000..41e0a1f --- /dev/null +++ b/isso/defaults.ini @@ -0,0 +1 @@ +../share/isso.conf \ No newline at end of file diff --git a/isso/dispatch.py b/isso/dispatch.py index c9fd2cc..def980e 100644 --- a/isso/dispatch.py +++ b/isso/dispatch.py @@ -20,16 +20,17 @@ class Dispatcher(DispatcherMiddleware): a relative URI, e.g. /foo.example and /other.bar. """ - default = os.path.join(dist.location, "share", "isso.conf") + conf = os.path.join(dist.location, "isso", "defaults.ini") def __init__(self, *confs): self.isso = {} - for i, conf in enumerate(map(config.load(Dispatcher.default, conf))): + for path in confs: + conf = config.load(Dispatcher.conf, path) if not conf.get("general", "name"): - logger.warn("unable to dispatch %r, no 'name' set", confs[i]) + logger.warn("unable to dispatch %r, no 'name' set", path) continue self.isso["/" + conf.get("general", "name")] = make_app(conf) diff --git a/isso/run.py b/isso/run.py index 7a003b5..2b5fa9b 100644 --- a/isso/run.py +++ b/isso/run.py @@ -7,6 +7,6 @@ from isso import dist, config application = make_app( config.load( - os.path.join(dist.location, "share", "isso.conf"), + os.path.join(dist.location, "isso", "defaults.ini"), os.environ.get('ISSO_SETTINGS')), multiprocessing=True) diff --git a/isso/tests/test_comments.py b/isso/tests/test_comments.py index 70bd3a3..29af342 100644 --- a/isso/tests/test_comments.py +++ b/isso/tests/test_comments.py @@ -32,7 +32,7 @@ class TestComments(unittest.TestCase): def setUp(self): fd, self.path = tempfile.mkstemp() - conf = config.load(os.path.join(dist.location, "share", "isso.conf")) + conf = config.load(os.path.join(dist.location, "isso", "defaults.ini")) conf.set("general", "dbpath", self.path) conf.set("guard", "enabled", "off") conf.set("hash", "algorithm", "none") @@ -380,7 +380,7 @@ class TestModeratedComments(unittest.TestCase): def setUp(self): fd, self.path = tempfile.mkstemp() - conf = config.load(os.path.join(dist.location, "share", "isso.conf")) + conf = config.load(os.path.join(dist.location, "isso", "defaults.ini")) conf.set("general", "dbpath", self.path) conf.set("moderation", "enabled", "true") conf.set("guard", "enabled", "off") @@ -412,7 +412,7 @@ class TestPurgeComments(unittest.TestCase): def setUp(self): fd, self.path = tempfile.mkstemp() - conf = config.load(os.path.join(dist.location, "share", "isso.conf")) + conf = config.load(os.path.join(dist.location, "isso", "defaults.ini")) conf.set("general", "dbpath", self.path) conf.set("moderation", "enabled", "true") conf.set("guard", "enabled", "off") diff --git a/isso/tests/test_guard.py b/isso/tests/test_guard.py index 837d492..c76eb82 100644 --- a/isso/tests/test_guard.py +++ b/isso/tests/test_guard.py @@ -37,7 +37,7 @@ class TestGuard(unittest.TestCase): def makeClient(self, ip, ratelimit=2, direct_reply=3, self_reply=False): - conf = config.load(os.path.join(dist.location, "share", "isso.conf")) + conf = config.load(os.path.join(dist.location, "isso", "defaults.ini")) conf.set("general", "dbpath", self.path) conf.set("hash", "algorithm", "none") conf.set("guard", "enabled", "true") diff --git a/isso/tests/test_vote.py b/isso/tests/test_vote.py index f6817a0..4266654 100644 --- a/isso/tests/test_vote.py +++ b/isso/tests/test_vote.py @@ -26,7 +26,7 @@ class TestVote(unittest.TestCase): def makeClient(self, ip): - conf = config.load(os.path.join(dist.location, "share", "isso.conf")) + conf = config.load(os.path.join(dist.location, "isso", "defaults.ini")) conf.set("general", "dbpath", self.path) conf.set("guard", "enabled", "off") conf.set("hash", "algorithm", "none")