Add new GET /api/config/_properties endpoint#2356
Conversation
|
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
… items Signed-off-by: DL6ER <dl6er@dl6er.de>
2a72ec6 to
60e0793
Compare
|
Conflicts have been resolved. |
|
Rebased on latest |
There was a problem hiding this comment.
Copilot wasn't able to review any files in this pull request.
Files not reviewed (6)
- src/api/api.c: Language not supported
- src/api/api.h: Language not supported
- src/api/config.c: Language not supported
- src/api/docs/content/specs/config.yaml: Language not supported
- src/api/docs/content/specs/main.yaml: Language not supported
- test/test_suite.bats: Language not supported
yubiuser
left a comment
There was a problem hiding this comment.
Should users be able to query specific properties directly? Like pihole api config/_properties/read_only ?
Maybe I don't understand misc.readOnly but I would have expected all configuration elements to be returned when misc.readOnly=true
nanopi@nanopi:~$ pihole api config/_properties
API Authentication: Not needed
Requesting: GET https://127.0.0.1:443/api/config/_properties
Status: 200
Data:
{
"config": {
"read_only": [
{
"key": "misc.readOnly",
"reason": "read_only",
"description": "Variable can only be set in pihole.toml, not via API"
}
]
},
"took": 0.00019168853759765625
}
API Logout: Success (no valid session)
nanopi@nanopi:~$ pihole-FTL --config misc.readOnly
true
I don't think so. It'd mean adding a lot of code for a feature that is unlikely to be used interactively. This is only meant for the external scripts to have such information available, see #2348 (comment) for the motivation behind this PR.
Yes, this makes sense. I will change this. |
…config items as read-only Signed-off-by: Dominik <dl6er@dl6er.de>
| reason = "read_only"; | ||
| description = "Config is in read-only mode"; | ||
| } | ||
| else if(conf_item->f & FLAG_READ_ONLY) |
There was a problem hiding this comment.
Is this case still needed after you added the case for misc.readOnly. Because I think FLAG_READ_ONLY is only set once misc.readOnly is true.
There was a problem hiding this comment.
This is a special flag that a dedicated feature on its own. Only misc.readOnly has this flag. It prevents the CLI and/or the API from being able to set this option (and effective lock out itself). It is there to "protect" users. You can set this only by manually editing pihole.toml.
What does this implement/fix?
Add new
GET /api/config/_propertiesendpoint listing read-only config items. It may be extended to more things later. See #2348Related issue or feature (if applicable): N/A
Pull request in docs with documentation (if applicable): N/A
By submitting this pull request, I confirm the following:
git rebase)Checklist:
developmentalbranch.