Add per-database _config API endpointAdd per db config api 5685 #5803
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR implements a new
/{db}/_configAPI endpoint that provides a unified, extensible interface for database-specific configuration settings, as requested in issue #5685.Overview
The implementation follows the pattern of the server-level
/_configAPI and consolidates existing per-database configuration endpoints (_revs_limit,_purged_infos_limit,_auto_purge) into a cohesive structure while maintaining full backward compatibility.Changes Made
Modified Files
src/chttpd/src/chttpd_httpd_handlers.erl(1 line added)_configendpointsrc/chttpd/src/chttpd_db.erl(~220 lines added)handle_db_config_req/2API Endpoints
GET
/{db}/_configReturns all configuration sections and their values.
Example Response:
{ "revs": {"limit": 1000}, "purges": {"limit": 1000}, "auto_purge": {"deleted_document_ttl": null}, "compaction": {"generations": 0} }GET
/{db}/_config/{section}Returns all keys in a specific section.
Example:
GET /mydb/_config/revs{"limit": 1000}GET
/{db}/_config/{section}/{key}Returns a specific configuration value.
Example:
GET /mydb/_config/revs/limit→1000PUT
/{db}/_config/{section}/{key}Updates a configuration value and returns the old value.
Example:
PUT /mydb/_config/revs/limitwith body2000→ returns1000DELETE
/{db}/_config/{section}/{key}Resets a configuration value to its default and returns the old value.
Supported Configuration Sections
1.
revsSectionlimit(integer, default: 1000)/{db}/_revs_limit(still supported for backward compatibility)2.
purgesSectionlimit(positive integer, default: 1000)/{db}/_purged_infos_limit(still supported for backward compatibility)3.
auto_purgeSectiondeleted_document_ttl(string, default: null)/{db}/_auto_purge(still supported for backward compatibility)4.
compactionSectiongenerations(integer, default: 0)Backward Compatibility
✅ All existing endpoints continue to work:
/{db}/_revs_limit/{db}/_purged_infos_limit/{db}/_auto_purgeThe new
_configAPI internally uses the same fabric layer functions, ensuring consistency.Implementation Details
Fixes #5685<!-- Thank you for your contribution!
Overview
Testing recommendations
Related Issues or Pull Requests
Checklist
rel/overlay/etc/default.inisrc/docsfolder