summaryrefslogtreecommitdiff
path: root/src/conf_mode/https.py
diff options
context:
space:
mode:
authorChristian Breunig <christian@breunig.cc>2023-11-23 11:35:21 +0100
committerGitHub <noreply@github.com>2023-11-23 11:35:21 +0100
commit6afd6eeb87a3a4ecbbd5aa9c67622d0b3c27721c (patch)
tree98f117cbd134b1b5bf56e6c73002e37e2cd6634c /src/conf_mode/https.py
parentc1e170c88cd2222f5ec65764e1559b99efa6a862 (diff)
parent33d5d429f590146ce28a6e992ccb024492bf07f6 (diff)
downloadvyos-1x-6afd6eeb87a3a4ecbbd5aa9c67622d0b3c27721c.tar.gz
vyos-1x-6afd6eeb87a3a4ecbbd5aa9c67622d0b3c27721c.zip
Merge pull request #2532 from jestabro/drop-http-api-conf
http-api: T5768: remove auxiliary http-api.conf
Diffstat (limited to 'src/conf_mode/https.py')
-rwxr-xr-xsrc/conf_mode/https.py25
1 files changed, 4 insertions, 21 deletions
diff --git a/src/conf_mode/https.py b/src/conf_mode/https.py
index 5cbdd1651..81e510b0d 100755
--- a/src/conf_mode/https.py
+++ b/src/conf_mode/https.py
@@ -52,7 +52,7 @@ default_server_block = {
'address' : '*',
'port' : '443',
'name' : ['_'],
- 'api' : {},
+ 'api' : False,
'vyos_cert' : {},
'certbot' : False
}
@@ -232,35 +232,18 @@ def generate(https):
# certbot organizes certificates by first domain
sb['certbot_domain_dir'] = cert_domains[0]
- # get api data
-
- api_set = False
- api_data = {}
if 'api' in list(https):
- api_set = True
- api_data = vyos.defaults.api_data
- api_settings = https.get('api', {})
- if api_settings:
- vhosts = https.get('api-restrict', {}).get('virtual-host', [])
- if vhosts:
- api_data['vhost'] = vhosts[:]
-
- if api_data:
- vhost_list = api_data.get('vhost', [])
+ vhost_list = https.get('api-restrict', {}).get('virtual-host', [])
if not vhost_list:
for block in server_block_list:
- block['api'] = api_data
+ block['api'] = True
else:
for block in server_block_list:
if block['id'] in vhost_list:
- block['api'] = api_data
-
- if 'server_block_list' not in https or not https['server_block_list']:
- https['server_block_list'] = [default_server_block]
+ block['api'] = True
data = {
'server_block_list': server_block_list,
- 'api_set': api_set,
'certbot': certbot
}