???????????ù???
???????????з? ???????[ 2017/3/15 10:47:15 ] ????????????? ???ù???
????????
???????????? ??????????????
????· ????г???
????· ????
????· ????
????????????????????????????????????????????????????????????????????
????1. ????????????
????1) ??????
????· ???????????????
????· ??????????????????
????2) ??????????
?????????????????????????????????????????? ??????????????????????????
??????????????? ????????
????3) ??????????
?????????????????????????????????????????? ??????????????????????????????????????????????? ??????????????????????? ????????????????δ???????????????????????? ??????????????????
?????????????ζ?????ò?? ???÷????????????????? ??????????? ???????-??-???????????
????4) ?????????
??????????????????????
????????????? ?????? ?????????????????????? ??????? ???????? ?????????????? ???????????????? ???????????? ?÷????Σ??????????????e??????
????5) ????????????
??????????????? ??????е??????? ?????????????????????????? ????????????????
????????????????? ???? SSoT(Single Source of Truth)?? ???????????????????????? ???????????????? ??ж??????????????????????
????2. ?????汾????
???????д????????????????????汾????
????· ?????
????· ???????
????· ????????
????· ???????????
????· ???
???????????????? ?????? Markdown ????????????????洢?? ??????汾??????
???????? https://www.websequencediagrams.com?? http://yuml.me
????· ???????????
??????????????????????????????????????????£???ó?????????
????· ???y????????
????3. ?????????
???????÷??????? ?????ī??????????????????????? ??????????????
????????????
??????????к?????????????????????IP?? ????????????????????
???????????:
??????????? ????????????壬 ???????????????廨?????
????· ini
????· properties
????· json
????· xml
????· yaml
?????? lua?? python?? ruby????????????? ???????????????????????
???????Щ????????? DSL ??????????????????????????
??????????У? ???????????????? ?????????????? ?? ?? python + json ???????????
?????????????γ????? ????????????????????????
????{
????"username": "walter"??
????"password": "xxx"??
????"email": "walter@xxx.com"??
????"courses": [ ]??
????"scores": { }
????}
?????????python ????????
import json
import os
import sys
class UserConfig:
def __init__(self?? json_file):
self.read_config(json_file)
self.username = self.config_data['username']
self.password = self.config_data['password']
self.email = self.config_data['email']
def read_config(self?? json_file):
json_data=open(json_file)
self.config_data = json.load(json_data)
def dump_config(self):
print self.config_data
print "username="?? self.username
print "password="?? self.password
print "email="?? self.email
if __name__ == "__main__":
args = sys.argv
usage = "usage: python %s <config_file>" % args[0]
argc = len(args)
if(argc < 2):
print usage
else:
json_file = args[1]
print("* the json config file is " + args[1])
config = UserConfig(json_file)
config.dump_config()
??????н??
????$ python user_config.py user_config.json
????* the json config file is user_config.json
????{u'username': u'walter'?? u'courses': []?? u'password': u'xxx'?? u'email': u'walter@xxx.com'?? u'scores': {}}
????username= walter
????password= xxx
????email= walter@xxx.com
?????????????
??????????????洢?????????????????????????????????
?????????????????? key/value ???
??????? Cassandra ?? NOSQL ??????
???????÷???
???????????????????????????????????????? ??REST API??????????????????? ???????е??????????????????????????????????
???????????
????
Configure Service
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11