一个程序是否可以访问两个appid(用client 包实现,非自己封装接口)
我有如下的业务场景,看看有没有其他的破解之道: 对于一个项目来说,因涉及到运维密码相关配置(独立namespace:简称 secret-namespace)问题(如数据库密码等),理论上说,业务开发人员不可见。目前一个项目对应一个apollo 应用,而应用管理员权限交由业务负责人管理(因项目太多,运维管理忙不过来),这样管理员就具有了查看secret-namespace 配置的权限。 目前想到的方案:
- apollo应用 管理员权限交由运维管理,这样由于项目太多,给用户分配权限估计就忙死了。
- secret-namespace 独立出一个apollo应用,然后其他apollo应用继承,因继承需public属性,更不可取。
- secret-namespace 独立出一个apollo应用,然后程序一次性加载 两个 apollo 应用,通过接口可实现,但不建议提供用户使用的复杂度,所以想问apollo-client 是否支持?
- 有没有其他更合理的方案?
数据库密码可以加密存储,然后提供数据访问层的SDK做解密
现在就是这样做的,但用户知道 key 和 password ,一样可以在线解密,只是操作稍微复杂了,并没有杜绝密码泄露问题。 所以想到将secret-namespace 独立出一个apollo应用,然后程序一次加载两个apollo 应用,但好像现在apollo-client 不支持(通过接口可实现,但增加了各项目用户使用的复杂度)?还有其他什么方案吗?
实在不行,可以基于hide_ 前缀,后端返回做隐藏处理(展示、更改历史、发布历史),也是个不错的方案,对用户影响最小。
apollo-client 不支持同时加载多个appId,能不能增加一个AppService类. ConfigService myconfig = AppService.getConfig(String myAppId); 这样的方式. 这样做的目前, 主要是兼容目前在同一个项目中,加载多个团队开发的jar,各自都有配置需要加载.
这样在各种实际项目中, 对客户端加载配置会友好很多. 特别在做一些项目迁移, 需要考虑到实际已经存在的代码,很多逻辑不能够改掉太大.
I think this is a topic still worth discussing.
Supporting multiple appids in apollo-client is a difficult job as apollo-client is designed to work with only one appid, and it involves a huge amount of refactoring work.
Back to the original topic raised by @xiaoxiaojushi-ivan, separating secret-namespace to a standalone app and letting the client load from 2 apps solves the security issue in apollo-portal, but I'm not sure whether it solves the ultimate security issue since the configurations are still accessible by accessing apollo-configservice. There is a related discussion #3187, which we could reference for background information.
强烈建议支持多个app,多个appid 可以相互隔离