config version manager with web or code easily
Project description
conftab
config table
配置web版本管理系统 config version manager with web or code easily
RUN
- 服务端: 启动web管理界面
pip install conftab
# 运用sqlite数据库,-f指定配置数据的保存文件位置,-p指定
python -m conftab.ctl run -p 7788 -f './conftab.db'
# 浏览器可以访问 http://127.0.0.1:7788/html/conf
# 进行界面config管理
- 客户端: 项目通过接口在线取config配置
import conftab
CONFIG = conftab.Tab(project='default', env='dev', ver='1.0.0', manager_url='127.0.0.1:7788')
# 设置
CONFIG.set('ES_PORT', 9200) # (可以在代码里也可以在web界面里去调整)
# 获取
ES_PORT = CONFIG.get('ES_PORT')
import conftab
import multiprocessing
import time
import requests
# 启动服务
multiprocessing.Process(target=conftab.run_app, args=('0.0.0.0', 7788)).start()
# 等待初始化服务
time.sleep(2)
# 初始化客户端服务
conft = conftab.Tab('127.0.0.1:7788', project='xxx', env='dev', ver='v1.0.1')
# 客户端取不存在的配置
print(conft.get('es_port', 9201))
# 设置配置,客户端通过代码设置配置,这部分可以通过web界面来管理设计
conft.set('es_port', 9200)
# 客户端取存在的配置
print(conft.get('es_port', 9201))
# 客户端列出全部配置,变成列表
print(conft.list(to_dict=False))
# 客户端列出全部配置,变成字典方便调用
print(conft.list(to_dict=True))
# 客户端通过web浏览器管理曾经全部的配置
print(requests.get('http://127.0.0.1:7788/html/conf').text)
TODO list
- web manager
- server manager
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
conftab-1.0.0.tar.gz
(17.7 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
conftab-1.0.0-py3-none-any.whl
(18.7 kB
view details)
File details
Details for the file conftab-1.0.0.tar.gz.
File metadata
- Download URL: conftab-1.0.0.tar.gz
- Upload date:
- Size: 17.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3eb1daf6a2b8eb569a6e58a99842ce85b58412f9ed6e2e95c83bfc2e50c2db31
|
|
| MD5 |
68022f2d1606419eb2a6202e8bf84769
|
|
| BLAKE2b-256 |
21ac224268486098d35eba7960784294d7aa65c04b558907fc22eb070f734f8c
|
File details
Details for the file conftab-1.0.0-py3-none-any.whl.
File metadata
- Download URL: conftab-1.0.0-py3-none-any.whl
- Upload date:
- Size: 18.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
784f7e97a28818da0716d52ca59fe5931f91b4fd2fc065c00b212d66eb934b8c
|
|
| MD5 |
92e00435b5e6a41a50777ac2a7a8dbad
|
|
| BLAKE2b-256 |
f805e3601854844e63c952931cce15a113d9c358d4ab166840808fa2b6fc9886
|