-
Notifications
You must be signed in to change notification settings - Fork 325
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
RFC: gluon-config-api #2296
base: main
Are you sure you want to change the base?
RFC: gluon-config-api #2296
Conversation
Fix bugs, ...
As of now, we prefer to use the existing uhttpd instance from the config-mode instead of creating our own.
This has not yet received a lot of attention. Can I provide additional information? Is there anything missing? |
Some unsorted thoughts:
I have not looked at the implementation yet. |
Some unstructured answers...
IIRC, libucl is ~51kb. I decided to use it for my RFC, since it worked more or less without much effort.
I used (more or less) the merging algorithm that you developed for ece.
Yes. I am aware of that code and looked into it. As it uses blobs instead of json, I decided not to use it as of now. Also I think, some parts were even unfinished. |
In the current version of this RFC, there is no patching of the old config based on the POST request. The new config is actually directly the body of the POST request. So there is no merging of the old config with the new config. This means that if you want to change just a single value, you have to retrieve the entire config and post it again. I know this is unperformant and ugly (especially for larger applications), but I think it could be useful for this API:
|
Btw. an example of how a config could look like can be found here: Link |
@NeoRaider This is lying around for over a year without any feedback. Is there any progress? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
takeaways
- frontend and backend should be able to verify against the same schema
- should still be possible to have config objects depending on installed packages (like batman-adv, or community specific packages)
- have a look at gluon-web-model for current implementation of data attributes and logic
- https://github.com/freifunk-gluon/gluon/blob/master/package/gluon-web-model/files/lib/gluon/web/view/model/section.html
- js in frontend evaluates that
- types and dependencies of fields should be exposed as well
- way to go:
- go step by step.
- gluon-web-model already provides information about dependencies/type/....
- expose this as API.
- try to build on this.
- javascript code should reference fields from backend.
- based on the information about dependencies/type/..., the frontend code could render a field.
- Most of the model definition could be reused.
- The biggest problem is, that fields are not well defined by their identifiers.
- One of the first steps would be to replace the enumeration of forms and sections.
@lemoer will also have a look at OpenAPI / swagger.
end | ||
end | ||
|
||
-- TODO: implement array |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
found it
@@ -0,0 +1,16 @@ | |||
# Copyright (C) 2021 Leonardo Moerlein <me at irrelefant.net> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
spdx
@@ -0,0 +1,16 @@ | |||
# Copyright (C) 2021 Leonardo Moerlein <me at irrelefant.net> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
spdx
@@ -0,0 +1,51 @@ | |||
# | |||
# Copyright (C) 2021 OpenWrt.org |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
spdx no further license comments
|
||
PKG_SOURCE_PROTO:=git | ||
PKG_SOURCE_URL:=https://github.com/vstakhov/libucl | ||
PKG_SOURCE_VERSION:=e6c5d8079b95796099693b0889f07a036f78ad77 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is my suggestion to support a REST API for the config-mode.
It basically works like this:
libucl
.Here is an example usage. To get the config, use the following command:
To get the complete schema, use:
Change contact from
Leo
toHans
:See the result:
Feel free to comment this approach.
(This is based on the ideas in #2238)