Skip to main content
These commands allow you to set and remove arbitrary keys from the common_site_config.json file.

set-common-config

Set one or more configuration values in the common site config.
bench config set-common-config -c KEY VALUE [-c KEY VALUE ...]

Options

-c, --config
tuple
required
Key-value pair to set in the configuration. Can be specified multiple times.

Value Type Handling

The command automatically handles type conversion:
  • Booleans: Use true or false (case-insensitive)
  • Numbers: Integers and floats are automatically detected
  • Lists/Dicts: Use Python literal syntax
  • Strings: Any other value is treated as a string

Examples

Set Database Configuration

bench config set-common-config -c db_host localhost -c db_port 3306
Sets:
{
  "db_host": "localhost",
  "db_port": 3306
}

Enable Developer Mode

bench config set-common-config -c developer_mode true
Sets:
{
  "developer_mode": true
}

Set Multiple Values

bench config set-common-config \
  -c auto_update false \
  -c max_file_size 10485760 \
  -c mail_server smtp.example.com

Set Complex Values

# Set a list
bench config set-common-config -c allowed_origins '["https://example.com"]'

# Set a dictionary
bench config set-common-config -c logging '{"level": "INFO"}'

Implementation Details

Location: bench/commands/config.py:58 The command uses Python’s ast.literal_eval() to safely parse values, allowing you to set complex data structures while preventing code injection.

remove-common-config

Remove one or more keys from the common site config.
bench config remove-common-config KEY [KEY ...]

Arguments

keys
string
required
One or more configuration keys to remove from common_site_config.json

Examples

Remove Single Key

bench config remove-common-config developer_mode

Remove Multiple Keys

bench config remove-common-config db_host db_port mail_server

Clean Up Test Configuration

bench config remove-common-config test_runner test_db_name

Implementation Details

Location: bench/commands/config.py:77 The command loads the current configuration, removes the specified keys if they exist, and writes the updated configuration back to disk.

Common Configuration Keys

Here are some commonly used configuration keys:
  • db_host - Database server hostname
  • db_port - Database server port
  • db_name - Default database name
  • db_password - Database password
  • mail_server - SMTP server hostname
  • mail_port - SMTP server port
  • mail_login - SMTP username
  • mail_password - SMTP password
  • auto_email_id - Default sender email
  • developer_mode - Enable developer mode (true/false)
  • disable_website_cache - Disable website caching
  • server_script_enabled - Enable server scripts
  • background_workers - Number of background workers
  • socketio_port - Socket.IO port
  • webserver_port - Web server port

Notes

Changes take effect immediately but may require restarting bench services to apply fully:
bench restart
Be careful when removing configuration keys. Some keys may be required for proper bench operation.

Build docs developers (and LLMs) love