The Trac Configuration File
Table of Contents
Trac configuration is done by editing the trac.ini config file, located in <projectenv>/conf/trac.ini. Changes to the configuration are usually reflected immediately, though changes to the [components] or [logging] sections will require restarting the web server. You may also need to restart the web server after creating a global configuration file when none was previously present.
The trac.ini configuration file should be writable by the web server, as Trac currently relies on the possibility to trigger a complete environment reload to flush its caches.
Global Configuration
In versions prior to 0.11, the global configuration was by default located in $prefix/share/trac/conf/trac.ini or /etc/trac/trac.ini, depending on the distribution. If you're upgrading, you may want to specify that file to inherit from. Literally, when you're upgrading to 0.11, you have to add an [inherit] section to your project's trac.ini file. Additionally, you have to move your customized templates and common images from $prefix/share/trac/... to the new location.
Global options will be merged with the environment-specific options, where local options override global options. The options file is specified as follows:
[inherit] file = /path/to/global/trac.ini
Multiple files can be specified using a comma-separated list.
Note that you can also specify a global option file when creating a new project, by adding the option --inherit=/path/to/global/trac.ini to trac-admin's initenv command. If you do not do this but nevertheless intend to use a global option file with your new environment, you will have to go through the newly generated conf/trac.ini file and delete the entries that will otherwise override those set in the global file.
There are two more entries in the [inherit] section, templates_dir for sharing global templates and plugins_dir, for sharing plugins. Those entries can themselves be specified in the shared configuration file, and in fact, configuration files can even be chained if you specify another [inherit] file there.
Note that the templates found in the templates/ directory of the TracEnvironment have precedence over those found in [inherit] templates_dir. In turn, the latter have precedence over the installed templates, so be careful about what you put there, notably if you override a default template be sure to refresh your modifications when you upgrade to a new version of Trac (the preferred way to perform TracInterfaceCustomization being still to write a custom plugin doing an appropriate ITemplateStreamFilter transformation).
Reference for settings
This is a brief reference of available configuration options, and their default settings.
[attachment]
max_size | Maximum allowed file size (in bytes) for ticket and wiki attachments. |
render_unsafe_content | Whether attachments should be rendered in the browser, or only made downloadable. Pretty much any file may be interpreted as HTML by the browser, which allows a malicious user to attach a file containing cross-site scripting attacks. For public sites where anonymous users can create attachments it is recommended to leave this option disabled (which is the default). |
[header_logo]
alt | Alternative text for the header logo. |
height | Height of the header logo image in pixels. |
link | URL to link to, from the header logo. |
src | URL of the image to use as header logo. It can be absolute, server relative or relative. If relative, it is relative to one of the /chrome locations: site/your-logo.png if your-logo.png is located in the htdocs folder within your TracEnvironment; common/your-logo.png if your-logo.png is located in the folder mapped to the htdocs_location URL. Only specifying your-logo.png is equivalent to the latter. |
width | Width of the header logo image in pixels. |
[inherit]
plugins_dir | Path to the shared plugins directory. Plugins in that directory are loaded in addition to those in the directory of the environment plugins, with this one taking precedence. (since 0.11) |
templates_dir | Path to the shared templates directory. Templates in that directory are loaded in addition to those in the environments templates directory, but the latter take precedence. (since 0.11) |
[logging]
log_file | If log_type is file, this should be a path to the log-file. Relative paths are resolved relative to the log directory of the environment. |
log_format | Custom logging format. If nothing is set, the following will be used: Trac[$(module)s] $(levelname)s: $(message)s In addition to regular key names supported by the Python logger library (see http://docs.python.org/library/logging.html), one could use: - $(path)s the path for the current environment - $(basename)s the last path component of the current environment - $(project)s the project name Note the usage of $(...)s instead of %(...)s as the latter form would be interpreted by the ConfigParser? itself. Example: ($(thread)d) Trac[$(basename)s:$(module)s] $(levelname)s: $(message)s (since 0.10.5) |
log_level | Level of verbosity in log. Should be one of (CRITICAL, ERROR, WARN, INFO, DEBUG). |
log_type | Logging facility to use. Should be one of (none, file, stderr, syslog, winlog). |
[mimeviewer]
max_preview_size | Maximum file size for HTML preview. (since 0.9) |
mime_map | List of additional MIME types and keyword mappings. Mappings are comma-separated, and for each MIME type, there's a colon (":") separated list of associated keywords or file extensions. (since 0.10) |
pygments_default_style | The default style to use for Pygments syntax highlighting. |
pygments_modes | List of additional MIME types known by Pygments. For each, a tuple mimetype:mode:quality has to be specified, where mimetype is the MIME type, mode is the corresponding Pygments mode to be used for the conversion and quality is the quality ratio associated to this conversion. That can also be used to override the default quality ratio used by the Pygments render. |
tab_width | Displayed tab width in file preview. (since 0.9) |
treat_as_binary | Comma-separated list of MIME types that should be treated as binary data. (since 0.11.5) |
[notification]
admit_domains | Comma-separated list of domains that should be considered as valid for email addresses (such as localdomain). |
email_sender | Name of the component implementing IEmailSender. This component is used by the notification system to send emails. Trac currently provides SmtpEmailSender for connecting to an SMTP server, and SendmailEmailSender for running a sendmail-compatible executable. (since 0.12) |
ignore_domains | Comma-separated list of domains that should not be considered part of email addresses (for usernames with Kerberos domains). |
mime_encoding | Specifies the MIME encoding scheme for emails. Valid options are 'base64' for Base64 encoding, 'qp' for Quoted-Printable, and 'none' for no encoding, in which case mails will be sent as 7bit if the content is all ASCII, or 8bit otherwise. (since 0.10) |
sendmail_path | Path to the sendmail executable. The sendmail program must accept the -i and -f options. (since 0.12) |
smtp_always_bcc | Email address(es) to always send notifications to, addresses do not appear publicly (Bcc:). (since 0.10). |
smtp_always_cc | Email address(es) to always send notifications to, addresses can be seen by all recipients (Cc:). |
smtp_default_domain | Default host/domain to append to address that do not specify one. |
smtp_enabled | Enable email notification. |
smtp_from | Sender address to use in notification emails. |
smtp_from_name | Sender name to use in notification emails. |
smtp_password | Password for SMTP server. (since 0.9) |
smtp_port | SMTP server port to use for email notification. |
smtp_replyto | Reply-To address to use in notification emails. |
smtp_server | SMTP server hostname to use for email notifications. |
smtp_subject_prefix | Text to prepend to subject line of notification emails. If the setting is not defined, then the [$project_name] prefix. If no prefix is desired, then specifying an empty option will disable it. (since 0.10.1). |
smtp_user | Username for SMTP server. (since 0.9) |
use_public_cc | Recipients can see email addresses of other CC'ed recipients. If this option is disabled (the default), recipients are put on BCC. (since 0.10) |
use_short_addr | Permit email address without a host/domain (i.e. username only). The SMTP server should accept those addresses, and either append a FQDN or use local delivery. (since 0.10) |
use_tls | Use SSL/TLS to send notifications over SMTP. (since 0.10) |
[project]
admin | E-Mail address of the project's administrator. |
admin_trac_url | Base URL of a Trac instance where errors in this Trac should be reported. This can be an absolute or relative URL, or '.' to reference this Trac instance. An empty value will disable the reporting buttons. (since 0.11.3) |
descr | Short description of the project. |
footer | Page footer text (right-aligned). |
icon | URL of the icon of the project. |
name | Name of the project. |
url | URL of the main project web site, usually the website in which the base_url resides. This is used in notification e-mails. |
[search]
default_disabled_filters | Specifies which search filters should be disabled by default on the search page. This will also restrict the filters for the quick search function. The filter names defined by default components are: wiki, ticket, milestone and changeset. For plugins, look for their implementation of the ISearchSource interface, in the get_search_filters() method, the first member of returned tuple. Once disabled, search filters can still be manually enabled by the user on the search page. (since 0.12) |
min_query_length | Minimum length of query string allowed when performing a search. |
[sqlite]
extensions | Paths to sqlite extensions, relative to Trac environment's directory or absolute. (since 0.12) |
[trac]
auth_cookie_lifetime | Lifetime of the authentication cookie, in seconds. This value determines how long the browser will cache authentication information, and therefore, after how much inactivity a user will have to log in again. The default value of 0 makes the cookie expire at the end of the browsing session. (since 0.12) |
auth_cookie_path | Path for the authentication cookie. Set this to the common base path of several Trac instances if you want them to share the cookie. (since 0.12) |
auto_preview_timeout | Inactivity timeout in seconds after which the automatic wiki preview triggers an update. This option can contain floating-point values. The lower the setting, the more requests will be made to the server. Set this to 0 to disable automatic preview. The default is 2.0 seconds. (since 0.12) |
auto_reload | Automatically reload template files after modification. |
backup_dir | Database backup location |
base_url | Reference URL for the Trac deployment. This is the base URL that will be used when producing documents that will be used outside of the web browsing context, like for example when inserting URLs pointing to Trac resources in notification e-mails. |
check_auth_ip | Whether the IP address of the user should be checked for authentication (since 0.9). |
database | Database connection string for this project |
debug_sql | Show the SQL queries in the Trac log, at DEBUG level. (Since 0.11.5) |
default_charset | Charset to be used when in doubt. |
default_handler | Name of the component that handles requests to the base URL. Options include TimelineModule, RoadmapModule, BrowserModule, QueryModule, ReportModule, TicketModule and WikiModule. The default is WikiModule. (since 0.9) |
default_language | The preferred language to use if no user preference has been set. (since 0.12.1) |
default_timezone | The default timezone to use |
genshi_cache_size | The maximum number of templates that the template loader will cache in memory. The default value is 128. You may want to choose a higher value if your site uses a larger number of templates, and you have enough memory to spare, or you can reduce it if you are short on memory. |
htdocs_location | Base URL for serving the core static resources below /chrome/common/. It can be left empty, and Trac will simply serve those resources itself. Advanced users can use this together with trac-admin ... deploy <deploydir> to allow serving the static resources for Trac directly from the web server. Note however that this only applies to the <deploydir>/htdocs/common directory, the other deployed resources (i.e. those from plugins) will not be made available this way and additional rewrite rules will be needed in the web server. |
ignore_auth_case | Whether login names should be converted to lower case (since 0.9). |
mainnav | Order of the items to display in the mainnav navigation bar, listed by IDs. See also TracNavigation. |
metanav | Order of the items to display in the metanav navigation bar, listed by IDs. See also TracNavigation. |
mysqldump_path | Location of mysqldump for MySQL database backups |
never_obfuscate_mailto | Never obfuscate mailto: links explicitly written in the wiki, even if show_email_addresses is false or the user has not the EMAIL_VIEW permission (since 0.11.6). |
permission_policies | List of components implementing IPermissionPolicy, in the order in which they will be applied. These components manage fine-grained access control to Trac resources. Defaults to the DefaultPermissionPolicy? (pre-0.11 behavior) and LegacyAttachmentPolicy? (map ATTACHMENT_* permissions to realm specific ones) |
permission_store | Name of the component implementing IPermissionStore, which is used for managing user and group permissions. |
pg_dump_path | Location of pg_dump for Postgres database backups |
request_filters | Ordered list of filters to apply to all requests (since 0.10). |
resizable_textareas | Make <textarea> fields resizable. Requires JavaScript. (since 0.12) |
secure_cookies | Restrict cookies to HTTPS connections. When true, set the secure flag on all cookies so that they are only sent to the server on HTTPS connections. Use this if your Trac instance is only accessible through HTTPS. (since 0.11.2) |
show_email_addresses | Show email addresses instead of usernames. If false, we obfuscate email addresses. (since 0.11) |
show_ip_addresses | Show IP addresses for resource edits (e.g. wiki). (since 0.11.3) |
timeout | Timeout value for database connection, in seconds. Use '0' to specify no timeout. (Since 0.11) |
use_base_url_for_redirect | Optionally use [trac] base_url for redirects. In some configurations, usually involving running Trac behind a HTTP proxy, Trac can't automatically reconstruct the URL that is used to access it. You may need to use this option to force Trac to use the base_url setting also for redirects. This introduces the obvious limitation that this environment will only be usable when accessible from that URL, as redirects are frequently used. (since 0.10.5) |
[wiki]
ignore_missing_pages | Enable/disable highlighting CamelCase links to missing pages (since 0.9). |
max_size | Maximum allowed wiki page size in bytes. (since 0.11.2) |
render_unsafe_content | Enable/disable the use of unsafe HTML tags such as <script> or <embed> with the HTML WikiProcessor (since 0.10.4). For public sites where anonymous users can edit the wiki it is recommended to leave this option disabled (which is the default). |
safe_schemes | List of URI schemes considered "safe", that will be rendered as external links even if [wiki] render_unsafe_content is false. (since 0.11.8) |
split_page_names | Enable/disable splitting the WikiPageNames with space characters (since 0.10). |
Reference for special sections
[components]
This section is used to enable or disable components provided by plugins, as well as by Trac itself. The component to enable/disable is specified via the name of the option. Whether its enabled is determined by the option value; setting the value to enabled or on will enable the component, any other value (typically disabled or off) will disable the component.
The option name is either the fully qualified name of the components or the module/package prefix of the component. The former enables/disables a specific component, while the latter enables/disables any component in the specified package/module.
Consider the following configuration snippet:
[components] trac.ticket.report.ReportModule = disabled webadmin.* = enabled
The first option tells Trac to disable the report module. The second option instructs Trac to enable all components in the webadmin package. Note that the trailing wildcard is required for module/package matching.
See the Plugins page on About Trac to get the list of active components (requires CONFIG_VIEW permissions.)
See also: TracPlugins
[milestone-groups]
(since 0.11)
As the workflow for tickets is now configurable, there can be many ticket states, and simply displaying closed tickets vs. all the others is maybe not appropriate in all cases. This section enables one to easily create groups of states that will be shown in different colors in the milestone progress bar.
Example configuration (the default only has closed and active):
closed = closed # sequence number in the progress bar closed.order = 0 # optional extra param for the query (two additional columns: created and modified and sort on created) closed.query_args = group=resolution,order=time,col=id,col=summary,col=owner,col=type,col=priority,col=component,col=severity,col=time,col=changetime # indicates groups that count for overall completion percentage closed.overall_completion = true new = new new.order = 1 new.css_class = new new.label = new # one catch-all group is allowed active = * active.order = 2 # CSS class for this interval active.css_class = open # Displayed label for this group active.label = in progress
The definition consists in a comma-separated list of accepted status. Also, '*' means any status and could be used to associate all remaining states to one catch-all group.
The CSS class can be one of: new (yellow), open (no color) or closed (green). New styles can easily be added using the following selector: table.progress td.<class>
[repositories]
(since 0.12 multirepos)
One of the alternatives for registering new repositories is to populate the [repositories] section of the trac.ini.
This is especially suited for setting up convenience aliases, short-lived repositories, or during the initial phases of an installation.
See TracRepositoryAdmin for details about the format adopted for this section and the rest of that page for the other alternatives.
[svn:externals]
(since 0.11)
The TracBrowser for Subversion can interpret the svn:externals property of folders. By default, it only turns the URLs into links as Trac can't browse remote repositories.
However, if you have another Trac instance (or an other repository browser like ViewVC) configured to browse the target repository, then you can instruct Trac which other repository browser to use for which external URL.
This mapping is done in the [svn:externals] section of the TracIni
Example:
[svn:externals] 1 = svn://server/repos1 http://trac/proj1/browser/$path?rev=$rev 2 = svn://server/repos2 http://trac/proj2/browser/$path?rev=$rev 3 = http://theirserver.org/svn/eng-soft http://ourserver/viewvc/svn/$path/?pathrev=25914 4 = svn://anotherserver.com/tools_repository http://ourserver/tracs/tools/browser/$path?rev=$rev
With the above, the svn://anotherserver.com/tools_repository/tags/1.1/tools external will be mapped to http://ourserver/tracs/tools/browser/tags/1.1/tools?rev= (and rev will be set to the appropriate revision number if the external additionally specifies a revision, see the SVN Book on externals for more details).
Note that the number used as a key in the above section is purely used as a place holder, as the URLs themselves can't be used as a key due to various limitations in the configuration file parser.
Finally, the relative URLs introduced in Subversion 1.5 are not yet supported.
[ticket-custom]
In this section, you can define additional fields for tickets. See TracTicketsCustomFields for more details.
[ticket-workflow]
(since 0.11)
The workflow for tickets is controlled by plugins. By default, there's only a ConfigurableTicketWorkflow component in charge. That component allows the workflow to be configured via this section in the trac.ini file. See TracWorkflow for more details.
See also: TracGuide, TracAdmin, TracEnvironment