Swarm 2014.1: User Guide

Configuration overview

This section provides an overview of all the possible configuration blocks in the data/config.php file. Click on any underlined item to see a detailed description.

Warning!

While the syntax of this example is correct, it includes configuration values that cannot work. Ensure that you adjust the configuration appropriately for your Swarm installation before using this example in testing or production.

<?php
    return array(
        'activity' => array(
            'ignored_users' => array(
                'git-fusion-user',
                'p4dtguser',
                'system',
            ),
        ),
        'avatars' => array(
            'http_url'  => 'http://www.gravatar.com/avatar/{hash}?s={size}&d={default}',
            'https_url' => 'https://secure.gravatar.com/avatar/{hash}?s={size}&d={default}',
        ),
        'environment' => array(
            'mode'      => 'production',
            'hostname'  => 'myswarm.host',
        ),
        'http_client_options'   => array(
            'timeout'   => 5,
            'hosts'     => array(),
        ),
        'jira' => array(
            'host'      => '',
            'user'      => '',
            'password'  => '',
            'job_field' => '',
        ),
        'log' => array(
            'priority'  => 5,
        ),
        'mail' => array(
            // 'recipients' => array('[email protected]'),
            'transport' => array(
                'host' => 'my.mx.host',
            ),
        ),
        'notifications' => array(
            'honor_p4_reviews'      => false,
            'opt_in_review_path'    => '//depot/swarm',
            'disable_change_emails' => false,
        ),
        'p4' => array(
            'port'      => 'my-perforce-service:1666',
            'user'      => 'admin_userid',
            'password'  => 'admin user ticket or password',
            'slow_command_logging' => array(
                3,
                10 => array('print', 'shelve', 'submit', 'sync', 'unshelve'),
            ),
        ),
        'projects' => array(
            'mainlines' => array(
                'main', 'mainline', 'master', 'trunk',
            ),
        ),
        'queue'  => array(
            'workers'             => 3,
            'worker_lifetime'     => 595,
            'worker_task_timeout' => 1800, // defaults to 30 minutes
            'worker_memory_limit' => '1G', // defailts to 1 gigabyte
        ),
        'reviews' => array(
            'patterns' => array(
                // #review or #review-1234 with surrounding whitespace/eol
                'octothorpe'      => array(
                    'regex'  => '/(?P<pre>\s+|^)'
                             .  '\#(?P<keyword>review)(?:-(?P<id>[0-9]+))?'
                             .  '(?P<post>\s+|$)/i',
                    'spec'   => '%pre%#%keyword%-%id%%post%',
                    'insert' => "%description%\n\n#review-%id%",
                    'strip'  => '/^\s*\#review(-[0-9]+)?(\s+|$)'
                             .  '|(\s+|^)\#review(-[0-9]+)?\s*$/i',
                ),

                // [review] or [review-1234] at start
                'leading-square'  => array(
                    'regex' => '/^(?P<pre>\s*)'
                            .  '\[(?P<keyword>review)(?:-(?P<id>[0-9]+))?\]'
                            .  '(?P<post>\s*)/i',
                    'spec'  => '%pre%[%keyword%-%id%]%post%',
                ),

                // [review] or [review-1234] at end
                'trailing-square' => array(
                    'regex' => '/(?P<pre>\s*)'
                            .  '\[(?P<keyword>review)(?:-(?P<id>[0-9]+))?\]'
                            .  '(?P<post>\s*)?$/i',
                    'spec'  => '%pre%[%keyword%-%id%]%post%',
                ),
            ),
            'disable_commit' => true,
        ),
        'security'  => array(
            'disable_autojoin'         => true,
            'email_restricted_changes' => false,
            'emulate_ip_protections'   => true,
            'https_port'               => null,
            'https_strict'             => false,
            'prevent_login'            => array(),
            'require_login'            => true,
        ),
        'xhprof' => array(
            'slow_time'      => 3,
            'ignored_routes' => array('download', 'imagick', 'libreoffice', 'worker'),
        ),
    );

Note

The Swarm configuration file does not include PHP's standard closing tag (?>). This is intentional as it prevents unintentional whitespace from being introduced into Swarm's output, which would interfere with Swarm's ability to control HTTP headers. Debugging problems that result from unintentional whitespace can be challenging, since the resulting behavior and error messages often appear to be misleading.

0 matching pages