{"id":15294732,"url":"https://github.com/vakinge/jeesuite-config","last_synced_at":"2025-04-13T14:53:46.606Z","repository":{"id":44454151,"uuid":"103143802","full_name":"vakinge/jeesuite-config","owner":"vakinge","description":"简约而不简单功能强大的配置中心。部署简单、支持多环境多版本配置管理。支持全局配置、多应用共享配置、配置加密、配置实时同步、spring/springboot无缝对接，细粒度权限控制、安全过滤等功能","archived":false,"fork":false,"pushed_at":"2022-12-14T20:41:28.000Z","size":2034,"stargazers_count":48,"open_issues_count":2,"forks_count":32,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-27T05:51:15.369Z","etag":null,"topics":["apollo","configcenter","configuration","disconf","distributed-systems","spring-boot"],"latest_commit_sha":null,"homepage":"http://www.jeesuite.com/","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/vakinge.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-09-11T14:07:37.000Z","updated_at":"2024-10-31T00:05:13.000Z","dependencies_parsed_at":"2023-01-29T01:00:50.110Z","dependency_job_id":null,"html_url":"https://github.com/vakinge/jeesuite-config","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vakinge%2Fjeesuite-config","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vakinge%2Fjeesuite-config/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vakinge%2Fjeesuite-config/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vakinge%2Fjeesuite-config/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vakinge","download_url":"https://codeload.github.com/vakinge/jeesuite-config/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248732513,"owners_count":21152851,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["apollo","configcenter","configuration","disconf","distributed-systems","spring-boot"],"created_at":"2024-09-30T17:06:32.110Z","updated_at":"2025-04-13T14:53:46.583Z","avatar_url":"https://github.com/vakinge.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 介绍\n\n## 为什么要造轮子？\n之前试用过几个开源的配置中心(disconf、Apollo、diamond以及Spring Cloud Config)，各有弊端或者是不满足我们的需求(譬如部署复杂、功能太复杂、不支持全局配置、不支持敏感配置加密，对springboot支持不友好,界面不友好或者无界面等等)。所以从2016年开始有了一个初级版本，经过三年生产环境实际需求不断完善于是就有了这个开源项目。\n\n## 主要功能清单\n   1. 支持多环境、多版本配置管理\n   1. 支持全局配置\n   2. 支持配置文件(properties,yaml,xml)、配置项、json配置支持\n   3. 支持加密配置(server自动加密，client自动解密)\n   4. 支持spring、springboot无缝对接\n   5. 支持环境+项目维度精细化权限(只读/读写)控制\n   6. 支持http和zookeeper方式配置实时同步\n   7. 支持查看配置历史版本、一键回滚、版本对比\n   8. 安全功能支持:可选开启安全ip功能与内网拉取配置限制\n   9. 多业务组/部门数据隔离\n   10. 支持集群部署\n\n## 特点\n - 轻量级：无需任何中间件(http方式下发同步)即可运行\n - 代码简单：二开成本低\n - 安全性高：除了配置加密功能外，还提供多种拉取配置安全策略\n\n# 服务端部署\n### 下载项目\n\n```\ngit clone https://gitee.com/vakinge/jeesuite-config.git\n```\n\n## 编译项目\n\n```\nmvn clean package -DskipTests=true\n```\n\n**最终生成部署包为：**jeesuite-config-server/target/jeesuite-config-server.jar\n\n## 创建数据库表\n\n```\nCREATE DATABASE IF NOT EXISTS `configcenter` DEFAULT CHARSET utf8 COLLATE utf8_general_ci;\n```\n\n执行建表脚本:db.sql\n\n## 关键配置说明（启动前请自行修改各个环境的配置）\n\n```\n#数据库配置\ndb_host=127.0.0.1\ndb_username=root\ndb_password=123456\n\n#是否允许外网拉取配置（白名单机制生效）\napi.extranet.enabled=true\n#敏感配置是否强制加密\nsensitive.config.force.encrypt=false\n\n#开启自动缓存（依赖redis）\njeesuite.mybatis.cacheEnabled=true\njeesuite.cache.mode=standalone\njeesuite.cache.servers=127.0.0.1:6379\njeesuite.cache.password=123456\njeesuite.cache.database=0\n\n#开启共享session（集群部署必须）\nsecurity.cache.storage-type=redis\nsecurity.cache.servers=127.0.0.1:6379\nsecurity.cache.password=123456\nsecurity.cache.database=1\n```\n\n\n## 启动\n拷贝**jeesuite-config-server.jar** 与 _**application.properties**_在同一目录，springboot会优先加载同一目录下名为_application.properties的配置文件。_\n\n```\nnohup java -jar jeesuite-config-server.jar \u003e config-server.out 2\u003e\u00261 \u0026\n```\n\n[](http://127.0.0.1:8080/admin.html)\n\nadmin/admin123\n\n\n## 操作指引\n - 业务组管理：如果需要分多个业务组，各个组需要隔离，请先`添加业务组`;\n - 用户管理：添加用户，可以指定业务组，默认密码为手机号后八位；\n - profile(环境)管理：可以为每个环境配置配置`同步的zookeeper`以及拉取配置`IP白名单`\n - 应用管理：添加应用,会自动生成对应每个环境的token\n - 配置管理：配置分全局配置与应用配置，支持配置文件、key-value配置、json配置\n\n---\n# 应用集成（客户端）\n\n## 添加依赖\n\n```\n\u003cdependency\u003e\n  \u003cgroupId\u003ecom.jeesuite\u003c/groupId\u003e\n  \u003cartifactId\u003ejeesuite-config-client\u003c/artifactId\u003e\n \u003cversion\u003e[版本号]\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\n## 添加配置\n\n在项目增加如下配置：\n```\n#是否启用配置中心，默认：true\njeesuite.configcenter.enabled=false\n#应用名：对应server端的应用配置\njeesuite.configcenter.appName=account\njeesuite.configcenter.base.url=http://configserver:8080\n#当前环境\njeesuite.configcenter.profile=dev\n#拉取配置版本，默认:latest\njeesuite.configcenter.version=latest\n#是否忽略全局配置,默认：false\njeesuite.configcenter.global-ignore=false\n#拉取配置认证的token\njeesuite.configcenter.token=\n#同步方式，默认:http\njeesuite.configcenter.sync-type=zookeeper\n# 同步间隔，同步方式为：http时生效\njeesuite.configcenter.sync-interval-seconds=30\n```\n\n\u003e通过JVM参数外部设置配置方式\n\n```\n-Djeesuite.configcenter.profile=dev\n```\n\n\u003edocker外部设置配置方式\n\n```\n-e jeesuite.configcenter.profile=\"dev\"\n```\n\n\u003espringboot项目增加以上配置即可，spring项目还需要做如下修改：\n\n\n1. 去掉原加载配置相关配置\n2. 新增配置\n\n```xml\n\u003cbean class=\"com.jeesuite.confcenter.spring.CCPropertyPlaceholderConfigurer\"\u003e\n    \u003cproperty name=\"remoteEnabled\" value=\"true\" /\u003e\n    \u003c!-- 本地配置文件，无本地配置可不配置 --\u003e\n    \u003cproperty name=\"locations\"\u003e\n      \u003clist\u003e\n        \u003cvalue\u003eclasspath*:application.properties\u003c/value\u003e\n      \u003c/list\u003e\n    \u003c/property\u003e\n\u003c/bean\u003e\n```\n\n## 一些用法\n\n### 配置优先级\n\n1. 应用本地配置 \u0026gt; 远程应用配置 \u0026gt; 远程全局配置\n2. 配置中心配置`jeesuite.configcenter.remote-config-first=true`可以启用远程配置覆盖本地配置\n\n### 配置实时生效\n\n配置变更后会实时下发到应用，可以通过以下方式实时读取最新配置  \n1. 在代码中使用`ResourceUtils`实时读取  \n2. 依赖注入`Environment`，在代码中实时读取  \n3. 实现`ConfigChangeHanlder`接口，自定义刷新逻辑\n\n---\n\n```java\n@Controller  \n@RequestMapping(value = \"/sms\")\npublic class AuthCommonController implements ConfigChangeHanlder{\n\n    @Value(\"${sms.send.open}\")\n    private boolean open = false;\n\n\n    @Override\n    public void onConfigChanged(Map\u003cString, Object\u003e changedConfigs) {\n        if(changedConfigs.containsKey(\"sms.send.open\")){\n            open = Boolean.parseBoolean(changedConfigs.get(\"sms.send.open\").toString());\n        }\n    }\n}\n```\n\n### 配置忽略\n正常情况应用的配置为全局配置与应用自身配置合并的结果，如果不需要某些全局配置项目如下配置即可\n```\ndb.maxActive=[Ignore]\n```\n\n#### 部分页面截图(基于`layui`构建)\n##### 新建配置\n![输入图片说明](https://images.gitee.com/uploads/images/2019/0612/162039_66a74f81_12388.png \"新增配置.png\")\n##### 查看配置\n![输入图片说明](https://images.gitee.com/uploads/images/2019/0612/162551_55f1292e_12388.png \"查看配置.png\")\n##### 用户权限管理\n![输入图片说明](https://images.gitee.com/uploads/images/2019/0612/163124_86171edc_12388.png \"用户权限.png\")\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvakinge%2Fjeesuite-config","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvakinge%2Fjeesuite-config","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvakinge%2Fjeesuite-config/lists"}