Commit f2c0cbd2 authored by 智勇's avatar 智勇

requests.get hostName

parent 2a547085
...@@ -7,7 +7,9 @@ import os ...@@ -7,7 +7,9 @@ import os
import os.path import os.path
import re import re
import copy import copy
import requests
opApiHost = 'http://172.30.220.22:3003'
f = io.open('replace_config.yaml', 'r', encoding='utf-8') f = io.open('replace_config.yaml', 'r', encoding='utf-8')
res = yaml.load(f) res = yaml.load(f)
print("全部配置信息:", res) print("全部配置信息:", res)
...@@ -50,6 +52,11 @@ for file in files: ...@@ -50,6 +52,11 @@ for file in files:
if rule.get('useNamespace', None) and rule['to']: if rule.get('useNamespace', None) and rule['to']:
rule['to'] = '-' + namespace + rule['to'] rule['to'] = '-' + namespace + rule['to']
if rule.get('useDomain',None):
domain = requests.get(opApiHost + '/proconfig/get_host?system_name=' + project)
domain = domain.json['data'].split('.')[0]
rule['to'] = domain + rule['to']
if rule['reg']: if rule['reg']:
p = re.compile(r'' + rule['reg']) p = re.compile(r'' + rule['reg'])
line = re.sub(p, rule['to'], line) line = re.sub(p, rule['to'], line)
......
...@@ -35,9 +35,14 @@ h5AuthRule: &h5AuthRule ...@@ -35,9 +35,14 @@ h5AuthRule: &h5AuthRule
reg: 'auth[-a-z]*\.[a-z]*\.[a-z]*' reg: 'auth[-a-z]*\.[a-z]*\.[a-z]*'
to: 'operator.liangkebang.com' to: 'operator.liangkebang.com'
# staticRule: &staticRule
# reg: '//static[-/0-9a-z.]*public'
# to: ''
staticRule: &staticRule staticRule: &staticRule
reg: '//static[-/0-9a-z.]*public' reg: '//static[-/0-9a-z.]*public'
to: '' to: *lkbDomain
useDomain: true
common: &common common: &common
h5AuthRule: *h5AuthRule h5AuthRule: *h5AuthRule
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment