Introduction
Welcome to the Empress developer guide on the Bench Set-Config
feature. This feature is a fundamental part of the Empress software development toolkit, enabling developers to insert or update values in the site configuration files effectively.
Overview and Importance
The Bench Set-Config
feature offers a wrapper command for updating values in the site’s site_config.json
, and the bench directory’s common_site_config.json
. Proper understanding and usage of this feature can significantly enhance your software customization and development process.
Technical Functionality and Advantages
This feature allows developers to manipulate key-value pairs in configuration files. The key advantage is the ability to manage and customize individual site configurations or global settings, which makes it a versatile tool in the development and customization of business solutions.
Detailed Explanation and Implementation
The Bench Set-Config
command follows the following syntax:
bench set-config [OPTIONS] KEY VALUE
Flags
The Bench Set-Config
command supports the following flags:
-g
,--global
: Set value in the Bench’s Common Site Config-p
,--parse
: Parse given value instead of string. You can use this to set dict and list values. This was--as-dict
in earlier versions.
Examples
Example 1: Enable tests for a given site.
bench --site {site} set-config allow_tests true
Example 2: Enable tests for all sites.
bench --site all set-config allow_tests true
Example 3: Set a dict value in your site’s frappe.conf
bench --site {site} set-config backup '{"includes": ["Not", "ToDo"]}' --parse
You can now access the list in code as frappe.conf.backup.get("includes")
.
User Roles and Permissions
It’s important to note that changes made using the Bench Set-Config
command should be performed by users with appropriate permissions in the system. Misuse can lead to potential security risks or unintended alterations in the system’s functionality.
Conclusion
The Bench Set-Config
feature provides a powerful tool for developers in the Empress ecosystem. Its ability to manage and customize site configurations offers significant advantages in software development and customization. By understanding and effectively employing this feature, developers can enhance their Empress development experience and create more powerful, customizable business solutions.