chore(project): 添加项目配置文件和忽略规则
- 添加 Babel 配置文件支持 ES6+ 语法转换 - 添加 ESLint 忽略规则和配置文件 - 添加 Git 忽略规则文件 - 添加 Travis CI 配置文件 - 添加 1.4.2 版本变更日志文件 - 添加 Helm 图表辅助模板文件 - 添加 Helm 忽略规则文件
This commit is contained in:
37
script/config-center/nacos/nacos-config.py
Normal file
37
script/config-center/nacos/nacos-config.py
Normal file
@@ -0,0 +1,37 @@
|
||||
#!/usr/bin/env python3
|
||||
# -*- coding: UTF-8 -*-
|
||||
|
||||
import http.client
|
||||
import sys
|
||||
import urllib.parse
|
||||
|
||||
if len(sys.argv) < 2:
|
||||
print ('python nacos-config.py nacosAddr')
|
||||
exit()
|
||||
|
||||
headers = {
|
||||
'content-type': "application/x-www-form-urlencoded"
|
||||
}
|
||||
|
||||
hasError = False
|
||||
for line in open('../config.txt'):
|
||||
pair = line.rstrip("\n").split('=')
|
||||
if len(pair) < 2:
|
||||
continue
|
||||
print (line),
|
||||
url_prefix = sys.argv[1]
|
||||
conn = http.client.HTTPConnection(url_prefix)
|
||||
if len(sys.argv) == 3:
|
||||
namespace=sys.argv[2]
|
||||
url_postfix = '/nacos/v1/cs/configs?dataId={0}&group=SEATA_GROUP&content={1}&tenant={2}'.format(urllib.parse.quote(str(pair[0])),urllib.parse.quote(str(pair[1])).strip(),namespace)
|
||||
else:
|
||||
url_postfix = '/nacos/v1/cs/configs?dataId={}&group=SEATA_GROUP&content={}'.format(urllib.parse.quote(str(pair[0])),urllib.parse.quote(str(pair[1]))).strip()
|
||||
conn.request("POST", url_postfix, headers=headers)
|
||||
res = conn.getresponse()
|
||||
data = res.read()
|
||||
if data.decode("utf-8") != "true":
|
||||
hasError = True
|
||||
if hasError:
|
||||
print ("init nacos config fail.")
|
||||
else:
|
||||
print ("init nacos config finished, please start seata-server.")
|
||||
Reference in New Issue
Block a user