summaryrefslogtreecommitdiffstats
path: root/testapi/opnfv_testapi
diff options
context:
space:
mode:
Diffstat (limited to 'testapi/opnfv_testapi')
-rw-r--r--testapi/opnfv_testapi/cmd/server.py2
-rw-r--r--testapi/opnfv_testapi/common/config.py19
-rw-r--r--testapi/opnfv_testapi/router/url_mappings.py2
-rw-r--r--testapi/opnfv_testapi/ui/root.py2
4 files changed, 5 insertions, 20 deletions
diff --git a/testapi/opnfv_testapi/cmd/server.py b/testapi/opnfv_testapi/cmd/server.py
index 50ac049..b7d3caa 100644
--- a/testapi/opnfv_testapi/cmd/server.py
+++ b/testapi/opnfv_testapi/cmd/server.py
@@ -38,7 +38,7 @@ from opnfv_testapi.tornado_swagger import swagger
def make_app():
swagger.docs(base_url=CONF.ui_url,
- static_path=CONF.static_path)
+ static_path=CONF.ui_static_path)
return swagger.Application(
url_mappings.mappings,
debug=CONF.api_debug,
diff --git a/testapi/opnfv_testapi/common/config.py b/testapi/opnfv_testapi/common/config.py
index 4cd53c6..140e492 100644
--- a/testapi/opnfv_testapi/common/config.py
+++ b/testapi/opnfv_testapi/common/config.py
@@ -16,14 +16,10 @@ import sys
class Config(object):
def __init__(self):
- self.config_file = None
+ self.config_file = '/etc/opnfv_testapi/config.ini'
self._set_config_file()
self._parse()
self._parse_per_page()
- self.static_path = os.path.join(
- os.path.dirname(os.path.normpath(__file__)),
- os.pardir,
- 'static')
def _parse(self):
if not os.path.exists(self.config_file):
@@ -56,23 +52,12 @@ class Config(object):
return value
def _set_config_file(self):
- if not self._set_sys_config_file():
- self._set_default_config_file()
-
- def _set_sys_config_file(self):
parser = argparse.ArgumentParser()
parser.add_argument("-c", "--config-file", dest='config_file',
help="Config file location", metavar="FILE")
args, _ = parser.parse_known_args(sys.argv)
- try:
+ if hasattr(args, 'config_file') and args.config_file:
self.config_file = args.config_file
- finally:
- return self.config_file is not None
-
- def _set_default_config_file(self):
- is_venv = os.getenv('VIRTUAL_ENV')
- self.config_file = os.path.join('/' if not is_venv else is_venv,
- 'etc/opnfv_testapi/config.ini')
CONF = Config()
diff --git a/testapi/opnfv_testapi/router/url_mappings.py b/testapi/opnfv_testapi/router/url_mappings.py
index be6240e..c038e88 100644
--- a/testapi/opnfv_testapi/router/url_mappings.py
+++ b/testapi/opnfv_testapi/router/url_mappings.py
@@ -72,7 +72,7 @@ mappings = [
# static path
(r'/(.*\.(css|png|gif|js|html|json|map|woff2|woff|ttf))',
tornado.web.StaticFileHandler,
- {'path': CONF.static_path}),
+ {'path': CONF.ui_static_path}),
(r'/', root.RootHandler),
(r'/api/v1/auth/signin', sign.SigninHandler),
diff --git a/testapi/opnfv_testapi/ui/root.py b/testapi/opnfv_testapi/ui/root.py
index 069ad5e..576cbdd 100644
--- a/testapi/opnfv_testapi/ui/root.py
+++ b/testapi/opnfv_testapi/ui/root.py
@@ -5,7 +5,7 @@ from opnfv_testapi.resources import handlers
class RootHandler(handlers.GenericApiHandler):
def get_template_path(self):
- return CONF.static_path
+ return CONF.ui_static_path
@check.login
def get(self):