Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEAT_REQUEST]: 新增配置设置功能 #192

Open
1 task done
imneov opened this issue May 11, 2022 · 1 comment
Open
1 task done

[FEAT_REQUEST]: 新增配置设置功能 #192

imneov opened this issue May 11, 2022 · 1 comment
Assignees

Comments

@imneov
Copy link
Contributor

imneov commented May 11, 2022

What Is Your Expect

问题or背景:

tKeel 中需要进行一些配置的存储于更新,例如样式、Logo等。

上述配置需要按照path设置,并且需要能够按照path来获取

目标(需求):

提供一个业务无关的配置接口

  • 设置部分需要权限控制
  • 读取部分无需安全限制

不做考虑的目标(需求)

高并发的更新

详细设计

数据存储格式

数据存储采用json格式,存储于dapr的State中。

接口定义

考虑采用如下定义:

  • Key:sting,业务Key,对应State中Json数据的key,需要增加前缀
  • Path:sting,路径,采用jsonPath格式,代表Key中具体的Json数据
  • Extra:bytes,Json格式或具体数据

使用流程

样式中心

Key = "thema"
Data={
    Default:{
       Logo: "EA$##$ASDAWWEQ",
       Color: 999966
   },
    Dark:{
       Logo: "EA$##$ASDAWWEQ",
       Color: 999966
   }
}

写入Dark配置

post  /v1/config/platform?key=thema&path=Dark
{
     Logo: "EA$##$ASDAWWEQ",
     Color: 999966
}

修改Dark的Color

post  /v1/config/platform?key=thema&path=Dark.Color
999966

读取Dark配置

get  /v1/config/platform?key=thema&path=Dark

读取Dark的Color

get  /v1/config/platform?key=thema&path=Dark.Color

Code of Conduct

  • I agree to follow this project's Code of Conduct

Contact Details

No response

@imneov
Copy link
Contributor Author

imneov commented May 11, 2022

$ curl -X POST 'http://127.0.0.1:31234/v1/config/platform/update?key=thema&path=a.b.c.d.f.g.h.j.k.l' -H 'content-type: application/json'  -d '{
    "temp": 203,
    "sysField": {
        "_spacePath": "tomas"
    }
}'

$ curl '127.0.0.1:31234/v1/config/platform?key=thema&path=a.b.c.d.f.g.h.j.k.l.sysField._spacePath'
"tomas"

$  curl -X DELETE '127.0.0.1:31234/v1/config/platform?key=thema&path=a.b.c.d.f.g.h.j.k.l.sysField'
{"_spacePath":"tomas"}                                                                                                                                                                      

$  curl '127.0.0.1:31234/v1/config/platform?key=thema&path=a.b.c.d.f.g.h.j.k.l.sysField._spacePath'
""                                                                                                                                                                                            ➜  bin

$  curl -X POST 'http://127.0.0.1:31234/v1/config/platform?key=thema&path=a.b.c.d.f.g.h.j.k.l' -H 'content-type: application/json'  -d '{
    "temp": 203,
    "sysField": {
        "_spacePath": "tomas"
    }
}'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants