X Tutup
Skip to content

Commit 232e328

Browse files
committed
读取配置
1 parent b828333 commit 232e328

File tree

2 files changed

+55
-0
lines changed

2 files changed

+55
-0
lines changed
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
{
2+
"db_info": {
3+
"host": "127.0.0.1",
4+
"user": "root",
5+
"password": "root",
6+
"stall-dbName": "promotion",
7+
"promotion-dbName": "promotion"
8+
},
9+
"@client_code": "1b1dfcc3-26a5-11ed-a331-3c7c3f602b59",
10+
"@tenant_code": "1e83ff35-26a5-11ed-a331-3c7c3f602b59",
11+
"@business_datasource_code": "dcp_grid",
12+
"@stall_datasource_code": "stall-assistant",
13+
"stall": {
14+
"target-table-list": [
15+
{
16+
"table-name": "t_api_m",
17+
"api-code-list": [
18+
"getUptownDataByCode",
19+
"getWebsiteDataByCode"
20+
],
21+
"where_filter": "client_code=@client_code and tenant_code=@tenant_code and datasource_code=@stall_datasource_code and code in(@api-code-list)",
22+
"column_code": [
23+
"client_code",
24+
"tenant_code",
25+
"datasource_code",
26+
"code",
27+
"name",
28+
"sql",
29+
"create_by",
30+
"create_date",
31+
"modify_by",
32+
"modify_date"
33+
]
34+
}
35+
]
36+
},
37+
"promotion": {
38+
}
39+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import json
2+
3+
4+
class ReadConfig:
5+
6+
def readDBJsonConfig(self):
7+
with open("promotion-connect-config.json", 'r') as json_file:
8+
config = json.load(json_file)
9+
print(config)
10+
server = config['db_info']['host']
11+
print(server)
12+
13+
14+
if '__main__' == __name__:
15+
config = ReadConfig();
16+
config.readDBJsonConfig()

0 commit comments

Comments
 (0)
X Tutup