From c5bba9111b8f6833d9551e20c05c12b610a53cc3 Mon Sep 17 00:00:00 2001
From: roadscape <roadscape@users.noreply.github.com>
Date: Tue, 27 Feb 2018 16:10:05 -0600
Subject: [PATCH] fix doc gen, move run_mode to conf #49

---
 Makefile     | 2 +-
 hive/conf.py | 7 +++++++
 run.py       | 2 +-
 3 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/Makefile b/Makefile
index e31ad476f..9e4182929 100644
--- a/Makefile
+++ b/Makefile
@@ -7,7 +7,7 @@ PROJECT_DOCKER_RUN_ARGS := --link db:db
 
 default: build
 
-.PHONY: test run test-without-lint test-pylint fmt test-without-build build
+.PHONY: test run test-without-lint test-pylint fmt test-without-build build docs
 
 docs:
 	pdoc --html hive --html-dir docs
diff --git a/hive/conf.py b/hive/conf.py
index 81e1d3dbb..cab395286 100644
--- a/hive/conf.py
+++ b/hive/conf.py
@@ -42,6 +42,13 @@ class Conf():
         assert cls._args, "run init_argparse()"
         return getattr(cls._args, param)
 
+    @classmethod
+    def run_mode(cls):
+        mode = '/'.join(cls.get('mode'))
+        valid = ['server', 'sync', 'status']
+        assert mode in valid, "invalid run mode %s" % mode
+        return mode
+
     @classmethod
     def log_level(cls):
         str_log_level = cls.get('log_level')
diff --git a/run.py b/run.py
index b52ac1554..7f4060a2d 100755
--- a/run.py
+++ b/run.py
@@ -7,7 +7,7 @@ from hive.server.serve import run_server
 
 def run():
     Conf.init_argparse()
-    mode = '/'.join(Conf.get('mode'))
+    mode = Conf.run_mode()
 
     if mode == 'server':
         run_server()
-- 
GitLab