summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--python/vyos/defaults.py12
-rwxr-xr-xsrc/conf_mode/http-api.py11
-rwxr-xr-xsrc/conf_mode/https.py13
3 files changed, 17 insertions, 19 deletions
diff --git a/python/vyos/defaults.py b/python/vyos/defaults.py
index 524b80424..ee307cf15 100644
--- a/python/vyos/defaults.py
+++ b/python/vyos/defaults.py
@@ -27,3 +27,15 @@ cfg_group = 'vyattacfg'
cfg_vintage = 'vyatta'
commit_lock = '/opt/vyatta/config/.lock'
+
+https_data = {
+ 'listen_address' : [ '127.0.0.1' ]
+}
+
+api_data = {
+ 'listen_address' : '127.0.0.1',
+ 'port' : '8080',
+ 'strict' : 'false',
+ 'debug' : 'false',
+ 'api_keys' : [ {"id": "testapp", "key": "qwerty"} ]
+}
diff --git a/src/conf_mode/http-api.py b/src/conf_mode/http-api.py
index c1d596ea3..1f91ac582 100755
--- a/src/conf_mode/http-api.py
+++ b/src/conf_mode/http-api.py
@@ -27,14 +27,6 @@ from vyos import ConfigError
config_file = '/etc/vyos/http-api.conf'
-default_config_data = {
- 'listen_address' : '127.0.0.1',
- 'port' : '8080',
- 'strict' : 'false',
- 'debug' : 'false',
- 'api_keys' : [ {"id": "testapp", "key": "qwerty"} ]
-}
-
vyos_conf_scripts_dir=vyos.defaults.directories['conf_mode']
# XXX: this model will need to be extended for tag nodes
@@ -43,7 +35,8 @@ dependencies = [
]
def get_config():
- http_api = default_config_data
+ http_api = vyos.defaults.api_data
+
conf = Config()
if not conf.exists('service https api'):
return None
diff --git a/src/conf_mode/https.py b/src/conf_mode/https.py
index e1e81eef1..2495cf7e7 100755
--- a/src/conf_mode/https.py
+++ b/src/conf_mode/https.py
@@ -21,6 +21,7 @@ import os
import jinja2
+import vyos.defaults
from vyos.config import Config
from vyos import ConfigError
@@ -75,16 +76,8 @@ server {
}
"""
-default_config_data = {
- 'listen_address' : [ '127.0.0.1' ]
-}
-
-default_api_config_data = {
- 'port' : '8080',
-}
-
def get_config():
- https = default_config_data
+ https = vyos.defaults.https_data
conf = Config()
if not conf.exists('service https'):
return None
@@ -96,7 +89,7 @@ def get_config():
https['listen_address'] = addrs[:]
if conf.exists('api'):
- https['api'] = default_api_config_data
+ https['api'] = vyos.defaults.api_data
if conf.exists('api port'):
port = conf.return_value('api port')