runtime-config / runtime-config Goto Github PK
View Code? Open in Web Editor NEWServer for storing service settings.
License: MIT License
Server for storing service settings.
License: MIT License
I noticed a smaller typo in setting
model. See the example:
{
"setting": {
"id": 0,
"name": "string",
"value": "string",
"value_type": "str",
"disable": true, <-------------------------- THIS
"service_name": "string",
"created_by_db_user": "string",
"updated_at": "2022-10-15T09:05:00.279Z"
},
"change_history": [
{
"id": 0,
"name": "string",
"value": "string",
"value_type": "str",
"disable": true, <-------------------------- THIS
"service_name": "string",
"created_by_db_user": "string",
"updated_at": "2022-10-15T09:05:00.279Z",
"is_deleted": true,
"deleted_by_db_user": "string"
}
]
}
I guess, it's supposed to be disabled
rather than disable
?
Thank you in advance! ๐
In the current implementation, the application returns this as a body of the response if the request was performed through HTTP/2:
No supported WebSocket library detected. Please use 'pip install uvicorn[standard]', or install 'websockets' or 'wsproto' manually.
There is no issue if I specify HTTP/1.1
as a preferred version for my HTTP client.
As I understood, the issue with uvicorn
that doesn't support it at all. That is not the case for hypercorn
, for instance. Anyways, I'm not a Python developer, so not really familiar with this.
I'm not sure if is that on purpose, or if it's an actual feature but settings are unreachable after deletion. See the example.
First, we create a setting.
curl -X 'POST' \
'http://localhost:8080/setting/create' \
-H 'accept: application/json' \
-H 'Content-Type: application/json' \
-d '{
"name": "name",
"value": "a",
"value_type": "str",
"disable": false,
"service_name": "default"
}'
-->
{
"id": 3,
"name": "name",
"value": "a",
"value_type": "str",
"disable": false,
"service_name": "default",
"created_by_db_user": "admin",
"updated_at": "2022-10-17T18:16:10.383388"
}
Second, we update it.
curl -X 'POST' \
'http://localhost:8080/setting/edit' \
-H 'accept: application/json' \
-H 'Content-Type: application/json' \
-d '{
"id": 3,
"name": "name",
"value": "b",
"value_type": "str",
"disable": false,
"service_name": "default"
}'
-->
{
"id": 3,
"name": "name",
"value": "b",
"value_type": "str",
"disable": false,
"service_name": "default",
"created_by_db_user": "admin",
"updated_at": "2022-10-17T18:20:13.212667"
}
Then fetch the setting with the history.
curl -X 'GET' \
'http://localhost:8080/setting/get/3?include_history=true' \
-H 'accept: application/json'
-->
{
"setting": {
"id": 3,
"name": "name",
"value": "b",
"value_type": "str",
"disable": false,
"service_name": "default",
"created_by_db_user": "admin",
"updated_at": "2022-10-17T18:22:05.588031"
},
"change_history": [
{
"id": 3,
"name": "name",
"value": "a",
"value_type": "str",
"disable": false,
"service_name": "default",
"created_by_db_user": "admin",
"updated_at": "2022-10-17T18:16:10.383388",
"is_deleted": false, <--- something interesting ๐
"deleted_by_db_user": null
}
]
}
Here we can see the presence of is_deleted
field. So, my assumption is that if I'm going to delete this setting, it will apply soft deletion and this is going to be reflected in the history.
curl -X 'GET' \
'http://localhost:8080/setting/delete/3' \
-H 'accept: application/json'
--->
{
"status": "success"
}
Now, let's get the setting once more.
curl -X 'GET' \
'http://localhost:8080/setting/get/3?include_history=true' \
-H 'accept: application/json'
-->
{
"setting": null,
"change_history": []
}
A-ha! The setting is null
, indeed. But, the history is empty. Not just null like we have on a newly created setting, but empty ๐ค. I suppose there is some issue with the history after deletion.
Hey-hey! ๐
I noticed a smaller inconsistency in the field naming strategy for this type of object:
{
"setting": {
"id": 2,
"name": "aboba",
"value": "false",
"value_type": "bool",
"disabled": false, <-------------------------------- THIS
"service_name": "default",
"created_by_db_user": "admin",
"updated_at": "2022-10-22T10:29:29.886533"
},
"change_history": [
{
"id": 6,
"name": "aboba",
"value": "true",
"value_type": "bool",
"disabled": false, <-------------------------------- THIS
"service_name": "default",
"created_by_db_user": "admin",
"updated_at": "2022-10-15T09:00:40.752155",
"is_deleted": false, <-------------------------------- THIS
"deleted_by_db_user": null
}
]
}
IMO, it should be either is_deleted
& is_disabled
, or deleted
& disabled
. I'd suggest following the second option because it's already verbose enough and doesn't conflict with Java's is...
getters ๐.
On /setting/get/{id}
, I can see that change_history
is always presented, no matter what is the value of include_history
param. It's either []
or the actual values, that feels a bit weird. I might expect this field to be missing or to be null
but not an empty array.
curl -X 'GET' \
'http://localhost:8080/setting/get/1?include_history=false' \
-H 'accept: application/json'
Expected response:
{
"setting": {
"id": 1,
"name": "data",
"value": "hello world2",
"value_type": "str",
"disable": false,
"service_name": "default",
"created_by_db_user": "admin",
"updated_at": "2022-10-09T11:24:00.738198"
}
}
Actual response:
{
"setting": {
"id": 1,
"name": "data",
"value": "hello world2",
"value_type": "str",
"disable": false,
"service_name": "default",
"created_by_db_user": "admin",
"updated_at": "2022-10-09T11:24:00.738198"
},
"change_history": []
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.