構成の概要
このセクションでは、SWARM_ROOT/data/config.php
ファイルで構成可能なすべての構成ブロックの概要を説明します。構成の概要を示す以下のサンプルコード内の構成可能変数のリンクをクリックすると、その変数の詳細な説明が表示されます。
以下に示す例の構文は正しいものですが、動作しない構成値も含まれています。以下のサンプルコードをテスト環境や本番環境で使用する前に、Swarmのインストール環境に合わせて、現在の構成を適切に調整してください。
構成情報を変更しても、構成キャッシュを再ロードしない限り、その構成情報がSwarmで使用されることはありません。構成キャッシュを再ロードすると、変更した構成情報がSwarmで強制的に使用されます。Swarm構成キャッシュを再ロードするには、admin ユーザまたはsuper ユーザでなくてはなりません。[ユーザID]ドロップダウンメニューに移動して[システム情報]を選択し、[キャッシュ情報]タブをクリックしてから[構成の再ロード]ボタンボタンをクリックします。
<?php
return array(
'activity' => array(
'ignored_users' => array(
'git-fusion-user',
'p4dtguser',
'system',
),
),
'archives' => array(
'max_input_size' => 512 * 1024 * 1024, // 512M (in bytes)
'archive_timeout' => 1800, // 30 minutes
'compression_level' => 1, // 0-9
'cache_lifetime' => 60 * 60 * 24, // 1 day
),
'attachments' => array(
'max_file_size' => 0, // the maximum file size to accept in bytes
),
'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}',
),
'comments' => array(
'notification_delay_time' => 1800, //Default to 30 minutes 1800 seconds
'threading' => array(
'max_depth' => 4, // default depth 4, to disable comment threading set to 0
),
),
'depot_storage' => array(
'base_path' => '//depot_name',
),
'diffs' => array(
'max_diffs' => 1500,
),
'environment' => array(
'mode' => 'production',
'hostname' => 'myswarm.hostname',
'external_url' => null,
'base_url' => null,
'logout_url' => null, // defaults to null
'vendor' => array(
'emoji_path' => 'vendor/gemoji/images',
),
),
'files' => array(
'max_size' => 1048576,
'download_timeout' => 1800,
'allow_edits' => true, // default is true
),
'groups' => array(
'super_only' => true, // ['true'|'false'] default value is 'false'
),
'http_client_options' => array(
'timeout' => 10, // default value is 10 seconds
'sslcapath' => '', // path to the SSL certificate directory
'sslcert' => '', // the path to a PEM-encoded SSL certificate
'sslpassphrase' => '', // the passphrase for the SSL certificate file
'hosts' => array(), // optional, per-host overrides. Host as key, array options as values
),
'jira' => array(
'host' => '', // URL for your installed Jira web interface
'api_host' => '', // URL for Jira API access, 'host' is used for Jira API access if 'api_host' is not set
'user' => '', // the username required for Jira API access
'password' => '', // the password required for Jira API access
'job_field' => '', // optional, if P4DTG is replicating Jira issue IDs to a job field, list that field here
'link_to_jobs' => false, // set to true to enable Perforce job links in Jira, P4DTG and job_field required
'delay_job_links' => 60, // delay in seconds, defaults to 60 seconds
'relationship' => '', // Jira subsection name links are added to defaults to empty, links added to the "links to" subsection
),
'log' => array(
'priority' => 3, // 7 for max, defaults to 3
'reference_id' => false // defaults to false
),
'mail' => array(
// 'recipients' => array('user@my.domain'),
'notify_self' => false,
'transport' => array(
'host' => 'my.mx.host',
),
),
'markdown' => array(
'markdown' => 'safe', // default is 'safe' 'disabled'|'safe'|'unsafe'
),
'mentions' => array(
'mode' => 'global',
'user_exclude_list' => array('super', 'swarm-admin'),
'group_exclude_list' => array('testers', 'writers'), // defaults to empty
),
'menu_helpers' => array(
'MyMenu01' => array( // A short recognizable name for the menu item
'id' => 'custom01', // A unique id for the menu item. If not included in the array, parent array name is used.
'enabled' => true, // ['true'|'false'] 'true' makes the menu item visible. 'true' is the default if not included in the array.
'target' => '/module/MyMenuItem/', // The URL or custom module route a menu click takes you to.
// If not included in array, id is used. If id not included, parent array name is used.
'cssClass' => 'custom_menu', // The custom CSS class name added to the menu item, appended to h2.menu- in Swarm CSS
'title' => 'MyMenuItem', // The text that will be shown on the button.
// If not included in array, id is used. If id not included, parent array name is used.
'class' => '', // If not included in array or empty, the menu item is added to the main menu.
// To add the menu item to the project menu for all of the projects, set to '\Projects\Menu\Helper\ProjectContextMenuHelper'
'priority' => 155, // The position the menu item is displayed at in the menu.
// If not included in the array, the menu item is placed at the bottom of the menu.
'roles' => null, // ['null'|'authenticated'|'admin'|'super'] If not included in the array, null is the default
// Specifies the minimum level of Perforce user that can see the menu item.
// 'authenticated' = any authorized user, 'null' = unauthenticated users
),
),
'notifications' => array(
'honor_p4_reviews' => false,
'opt_in_review_path' => '//depot/swarm',
'disable_change_emails' => false,
),
'p4' => array(
'port' => 'my-helix-core-server:1666',
'user' => 'admin_userid',
'password' => 'admin user ticket or password',
'sso' => 'disabled', // ['disabled'|'optional'|'enabled'] default value is 'disabled'
'proxy_mode' => true, // defaults to true
'slow_command_logging' => array(
3,
10 => array('print', 'shelve', 'submit', 'sync', 'unshelve'),
),
'max_changelist_files' => 1000,
'auto_register_url' => true,
),
'projects' => array(
'mainlines' => array(
'stable', 'release', // 'main', 'mainline', 'master', and 'trunk' are hardcoded, there is no need to add them to the array
),
'add_admin_only' => false,
'add_groups_only' => array(),
'edit_name_admin_only' => false,
'edit_branches_admin_only' => false,
'readme_mode' => 'enabled',
'fetch' => array('maximum' => 0), // defaults to 0 (disabled)
'allow_view_settings' => false, // defaults to false
),
'queue' => array(
'workers' => 3, // defaults to 3
'worker_lifetime' => 595, // defaults to 10 minutes (less 5 seconds)
'worker_task_timeout' => 1800, // defaults to 30 minutes
'worker_memory_limit' => '1G', // defaults to 1 gigabyte
),
'redis' => array(
'options' => array(
'password' => null, // Defaults to null
'namespace' => 'Swarm',
'server' => array(
'host' => 'localhost', // Defaults to 'localhost' or enter your Redis server hostname
'port' => '7379', // Defaults to '7379' or enter your Redis server port
),
),
'items_batch_size' => 100000,
'check_integrity' => '03:00', // Defaults to '03:00' Use one of the following options:
//'HH:ii' (24 hour format with leading zeros), the time the integrity check starts each day
// positive integer, the time between integrity checks in seconds. '0' = integrity check disabled
'population_lock_timeout' => 300, // Timeout for initial cache population. Defaults to 300 seconds.
),
'reviews' => array(
'patterns' => array(
'octothorpe' => array( // #review or #review-1234 with surrounding whitespace/eol
'regex' => '/(?P<pre>(?:\s|^)\(?)\#(?P<keyword>review|append|replace)(?:-(?P<id>[0-9]+))?(?P<post>[.,!?:;)]*(?=\s|$))/i',
'spec' => '%pre%#%keyword%-%id%%post%',
'insert' => "%description%\n\n#review-%id%",
'strip' => '/^\s*\#(review|append|replace)(-[0-9]+)?(\s+|$)|(\s+|^)\#(review|append|replace)(-[0-9]+)?\s*$/i',
),
'leading-square' => array( // [review] or [review-1234] at start
'regex' => '/^(?P<pre>\s*)\[(?P<keyword>review|append|replace)(?:-(?P<id>[0-9]+))?\](?P<post>\s*)/i',
'spec' => '%pre%[%keyword%-%id%]%post%',
),
'trailing-square' => array( // [review] or [review-1234] at end
'regex' => '/(?P<pre>\s*)\[(?P<keyword>review|append|replace)(?:-(?P<id>[0-9]+))?\](?P<post>\s*)?$/i',
'spec' => '%pre%[%keyword%-%id%]%post%',
),
),
'filters' => array(
'filter-max' => 15,
'result_sorting' => true,
'date_field' => 'updated', // 'created' displays and sorts by created date, 'updated' displays and sorts by last updated
),
'cleanup' => array(
'mode' => 'user', // auto - follow default, user - present checkbox(with default)
'default' => false, // clean up pending changelists on commit
'reopenFiles' => false, // re-open any opened files into the default changelist
),
'statistics' => array(
'complexity' => array(
'calculation' => 'default', // 'default|disabled'
'high' => 300,
'low' => 30
),
),
'commit_timeout' => 1800, // 30 minutes
'disable_commit' => true,
'moderator_approval' => 'any', // 'any|each'
'disable_self_approve' => false,
'end_states' => array('archived', 'rejected', 'approved:commit'),
'disable_approve_when_tasks_open' => false,
'process_shelf_delete_when' => array(),
'commit_credit_author' => true,
'ignored_users' => array(),
'unapprove_modified' => true,
'allow_author_change' => true,
'allow_author_obliterate' => false,
'sync_descriptions' => true,
'expand_all_file_limit' => 10,
'expand_group_reviewers' => false,
'more_context_lines' => 10, // defaults to 10 lines
),
'search' => array(
'maxlocktime' => 5000, // 5 seconds, in milliseconds
'p4_search_host' => '', // optional URL to Helix Search Tool
),
'security' => array(
'disable_system_info' => false,
'email_restricted_changes' => false,
'emulate_ip_protections' => true,
'https_port' => null,
'https_strict' => false,
'https_strict_redirect' => true,
'require_login' => true,
'prevent_login' => array(
'service_user1',
'service_user2',
),
),
'session' => array(
'cookie_lifetime' => 0, // lifetime in seconds, default value is 0=expire when browser closed
'remembered_cookie_lifetime' => 60*60*24*30, // lifetime in seconds, default value is 30 days
'gc_maxlifetime' => 60*60*24*30, // lifetime in seconds, default value is 30 days
'gc_divisor' => 100, // 100 user requests
),
'short_links' => array(
'hostname' => 'myho.st',
'external_url' => 'https://myho.st:port/sub-folder',
),
'tag_processor' => array(
'tags' => array(
'wip' => '/(^|\s)+#wip($|\s)+/i'
),
),
'test_definitions' => array(
'project_and_branch_separator' => ':',
),
'translator' => array(
'detect_locale' => true,
'locale' => array("en_GB", "en_US"),
'translation_file_patterns' => array(),
'non_utf8_encodings' => array('sjis', 'euc-jp', 'windows-1252'),
'utf8_convert' => true,
),
'upgrade' => array(
'status_refresh_interval' => 10, //Refresh page every 10 seconds
'batch_size' => 1000, //Fetch 1000 reviews to lower memory usage
),
'users' => array(
'dashboard_refresh_interval' => 300000, //Default 300000 milliseconds
'display_fullname' => false,
'settings' => array(
'review_preferences' => array(
'show_comments_in_files' => true,
'view_diffs_side_by_side' => true,
'show_space_and_new_line_characters' => false,
'ignore_whitespace' => false,
),
'time_preferences' => array(
'display' => 'Timeago', // Default to 'Timeago' but can be set to 'Timestamp'
),
),
),
'workflow' => array(
'enabled' => true, // Switches the workflow feature on. Default is true
),
'xhprof' => array(
'slow_time' => 3,
'ignored_routes' => array('download', 'imagick', 'libreoffice', 'worker'),
),
'saml' => array(...),
);
Swarmの構成ファイルには、PHPの標準的な終了タグである「?>」は含まれていません。Swarmの出力に不要な空白が挿入されるのを防ぐため、意図的にこの終了タグを除外しています。意図しない空白が挿入されると、HTTPヘッダを制御するSwarmの機能が正しく動作しなくなります。空白が入った結果として生じる動作やエラーメッセージはしばしば誤解を招くことがあるため、意図しない空白に起因するデバックの問題は難しい場合があります。