应用程序设置 API

这些 API 运行您获取和修改极狐GitLab 实例中的程序配置,具体位置位于 /admin/application_settings/general。您必须是管理员才能做此操作。

程序配置受缓存的影响,可能不会立即生效。 默认情况下,极狐GitLab 会缓存程序配置 60 秒。 如何在实例中控制程序配置缓存的更多信息,请查看程序缓存间隔

获取当前程序配置

列出当前极狐GitLab 实例中的程序配置

GET /application/settings
{
  "default_projects_limit" : 100000,
  "signup_enabled" : true,
  "id" : 1,
  "default_branch_protection" : 2,
  "default_preferred_language" : "en",
  "restricted_visibility_levels" : [],
  "password_authentication_enabled_for_web" : true,
  "after_sign_out_path" : null,
  "max_attachment_size" : 10,
  "max_export_size": 50,
  "max_import_size": 50,
  "user_oauth_applications" : true,
  "updated_at" : "2016-01-04T15:44:55.176Z",
  "session_expire_delay" : 10080,
  "home_page_url" : null,
  "default_snippet_visibility" : "private",
  "outbound_local_requests_whitelist": [],
  "domain_allowlist" : [],
  "domain_denylist_enabled" : false,
  "domain_denylist" : [],
  "created_at" : "2016-01-04T15:44:55.176Z",
  "default_ci_config_path" : null,
  "default_project_visibility" : "private",
  "default_group_visibility" : "private",
  "gravatar_enabled" : true,
  "container_expiration_policies_enable_historic_entries": true,
  "container_registry_cleanup_tags_service_max_list_size": 200,
  "container_registry_delete_tags_service_timeout": 250,
  "container_registry_expiration_policies_caching": true,
  "container_registry_expiration_policies_worker_capacity": 4,
  "container_registry_token_expire_delay": 5,
  "repository_storages_weighted": {"default": 100},
  "plantuml_enabled": false,
  "plantuml_url": null,
  "diagramsnet_enabled": true,
  "diagramsnet_url": "https://embed.diagrams.net",
  "kroki_enabled": false,
  "kroki_url": null,
  "terminal_max_session_time": 0,
  "polling_interval_multiplier": 1.0,
  "rsa_key_restriction": 0,
  "dsa_key_restriction": 0,
  "ecdsa_key_restriction": 0,
  "ed25519_key_restriction": 0,
  "ecdsa_sk_key_restriction": 0,
  "ed25519_sk_key_restriction": 0,
  "first_day_of_week": 0,
  "enforce_terms": true,
  "terms": "Hello world!",
  "performance_bar_allowed_group_id": 42,
  "user_show_add_ssh_key_message": true,
  "local_markdown_version": 0,
  "allow_local_requests_from_hooks_and_services": true,
  "allow_local_requests_from_web_hooks_and_services": true,
  "allow_local_requests_from_system_hooks": false,
  "asset_proxy_enabled": true,
  "asset_proxy_url": "https://assets.example.com",
  "asset_proxy_whitelist": ["example.com", "*.example.com", "your-instance.com"],
  "asset_proxy_allowlist": ["example.com", "*.example.com", "your-instance.com"],
  "maven_package_requests_forwarding": true,
  "npm_package_requests_forwarding": true,
  "pypi_package_requests_forwarding": true,
  "snippet_size_limit": 52428800,
  "issues_create_limit": 300,
  "raw_blob_request_limit": 300,
  "wiki_page_max_content_bytes": 52428800,
  "require_admin_approval_after_user_signup": false,
  "personal_access_token_prefix": "glpat-",
  "rate_limiting_response_text": null,
  "keep_latest_artifact": true,
  "admin_mode": false,
  "floc_enabled": false,
  "external_pipeline_validation_service_timeout": null,
  "external_pipeline_validation_service_token": null,
  "external_pipeline_validation_service_url": null,
  "jira_connect_application_key": null,
  "jira_connect_proxy_url": null,
  "silent_mode_enabled": false
}

专业版或旗舰版的用户也可能可以看见以下参数:

  • group_owners_can_manage_default_branch_protection
  • file_template_project_id
  • geo_node_allowed_ips
  • geo_status_timeout
  • delayed_project_deletion
  • delayed_group_deletion
  • default_project_deletion_protection
  • deletion_adjourned_period
  • disable_personal_access_tokens
  • security_policy_global_group_approvers_enabled
  • delete_unconfirmed_users
  • unconfirmed_users_delete_after_days

从 15.11 开始,启用 always_perform_delayed_deletion 功能标志后,delayed_project_deletiondelayed_group_deletion 参数将不会被公开。这些参数将在 16.0 中删除。

{
  "id": 1,
  "signup_enabled": true,
  "group_owners_can_manage_default_branch_protection": true,
  "file_template_project_id": 1,
  "geo_node_allowed_ips": "0.0.0.0/0, ::/0",
  "delayed_project_deletion": false,
  "delayed_group_deletion": false,
  "default_project_deletion_protection": false,
  "deletion_adjourned_period": 7,
  "disable_personal_access_tokens": false,
  ...
}

修改程序配置

调用此 API 来修改极狐GitLab 实例的程序配置

PUT /application/settings
curl --request PUT --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/application/settings?signup_enabled=false&default_project_visibility=internal"

响应示例:

{
  "id": 1,
  "default_projects_limit": 100000,
  "default_preferred_language": "en",
  "signup_enabled": false,
  "password_authentication_enabled_for_web": true,
  "gravatar_enabled": true,
  "created_at": "2015-06-12T15:51:55.432Z",
  "updated_at": "2015-06-30T13:22:42.210Z",
  "home_page_url": "",
  "default_branch_protection": 2,
  "restricted_visibility_levels": [],
  "max_attachment_size": 10,
  "max_export_size": 50,
  "max_import_size": 50,
  "session_expire_delay": 10080,
  "default_ci_config_path" : null,
  "default_project_visibility": "internal",
  "default_snippet_visibility": "private",
  "default_group_visibility": "private",
  "outbound_local_requests_whitelist": [],
  "domain_allowlist": [],
  "domain_denylist_enabled" : false,
  "domain_denylist" : [],
  "external_authorization_service_enabled": true,
  "external_authorization_service_url": "https://authorize.me",
  "external_authorization_service_default_label": "default",
  "external_authorization_service_timeout": 0.5,
  "user_oauth_applications": true,
  "after_sign_out_path": "",
  "container_expiration_policies_enable_historic_entries": true,
  "container_registry_cleanup_tags_service_max_list_size": 200,
  "container_registry_delete_tags_service_timeout": 250,
  "container_registry_expiration_policies_caching": true,
  "container_registry_expiration_policies_worker_capacity": 4,
  "container_registry_token_expire_delay": 5,
  "package_registry_cleanup_policies_worker_capacity": 2,
  "repository_storages": ["default"],
  "plantuml_enabled": false,
  "plantuml_url": null,
  "diagramsnet_enabled": true,
  "diagramsnet_url": "https://embed.diagrams.net",
  "terminal_max_session_time": 0,
  "polling_interval_multiplier": 1.0,
  "rsa_key_restriction": 0,
  "dsa_key_restriction": 0,
  "ecdsa_key_restriction": 0,
  "ed25519_key_restriction": 0,
  "ecdsa_sk_key_restriction": 0,
  "ed25519_sk_key_restriction": 0,
  "first_day_of_week": 0,
  "enforce_terms": true,
  "terms": "Hello world!",
  "performance_bar_allowed_group_id": 42,
  "user_show_add_ssh_key_message": true,
  "file_template_project_id": 1,
  "local_markdown_version": 0,
  "asset_proxy_enabled": true,
  "asset_proxy_url": "https://assets.example.com",
  "asset_proxy_allowlist": ["example.com", "*.example.com", "your-instance.com"],
  "geo_node_allowed_ips": "0.0.0.0/0, ::/0",
  "allow_local_requests_from_hooks_and_services": true,
  "allow_local_requests_from_web_hooks_and_services": true,
  "allow_local_requests_from_system_hooks": false,
  "maven_package_requests_forwarding": true,
  "npm_package_requests_forwarding": true,
  "pypi_package_requests_forwarding": true,
  "snippet_size_limit": 52428800,
  "issues_create_limit": 300,
  "raw_blob_request_limit": 300,
  "wiki_page_max_content_bytes": 52428800,
  "require_admin_approval_after_user_signup": false,
  "personal_access_token_prefix": "glpat-",
  "rate_limiting_response_text": null,
  "keep_latest_artifact": true,
  "admin_mode": false,
  "external_pipeline_validation_service_timeout": null,
  "external_pipeline_validation_service_token": null,
  "external_pipeline_validation_service_url": null,
  "can_create_group": false,
  "jira_connect_application_key": "123",
  "jira_connect_proxy_url": "http://gitlab.example.com",
  "user_defaults_to_private_profile": true,
  "projects_api_rate_limit_unauthenticated": 400,
  "silent_mode_enabled": false,
  "security_policy_global_group_approvers_enabled": true
}

使用极狐专业版或者旗舰版的用户可能还可以看见这些参数:

  • group_owners_can_manage_default_branch_protection
  • file_template_project_id
  • geo_node_allowed_ips
  • geo_status_timeout
  • delayed_project_deletion
  • delayed_group_deletion
  • default_project_deletion_protection
  • deletion_adjourned_period
  • disable_personal_access_tokens
  • security_policy_global_group_approvers_enabled
  • delete_unconfirmed_users
  • unconfirmed_users_delete_after_days

从 15.11 开始,开启 always_perform_delayed_deletion 功能标志后,delayed_project_deletiondelayed_group_deletion 参数不会被公开。这些参数将在 16.0 中移除。

响应示例:

  "file_template_project_id": 1,
  "geo_node_allowed_ips": "0.0.0.0/0, ::/0"

列出可通过 API 调用的配置

  • 字段 housekeeping_full_repack_periodhousekeeping_gc_periodhousekeeping_incremental_repack_period 废弃于极狐GitLab 15.8。使用 housekeeping_optimize_repository_period 代替。
  • 参数 sign_in_texthelp_text 废弃于极狐GitLab 16.2。现在使用外观 API 中的 description 参数代替。
  • 参数 phone_verification_code_enabled 引入于极狐GitLab 16.6。

通常情况下,所有配置都是可选的。如果启用某些设置,还需要设置其他配置才能正常工作。这些要求会在相关的设置的描述中列出来。

参数 类型 是否必需 描述
admin_mode boolean no 要求管理员通过重新认证来执行管理操作任务。
admin_notification_email string no 弃用:使用 abuse_notification_email 来代替。如果设置了,滥用报告会发送到此邮箱地址。滥用报告可在管理中心查看。
abuse_notification_email string no 如果设置了,滥用报告会发送到此邮箱地址。滥用报告可在管理区域查看。
after_sign_out_path string no 用户退出后的跳转地址。
after_sign_up_text string no 用户注册后的显示文本。
akismet_api_key string akismet_enabled 需要 Akismet 垃圾邮件保护的 API key。
akismet_enabled boolean no (如果启用,要求填写: akismet_api_key) 打开或关闭 Akismet 垃圾邮件保护。
allow_group_owners_to_manage_ldap boolean no 设置为 true 则运行群组所有者管理 LDAP。
allow_local_requests_from_hooks_and_services boolean no (弃用:使用 allow_local_requests_from_web_hooks_and_services 代替) 允许从 Webhook 和集成的请求到本地网络。
allow_local_requests_from_system_hooks boolean no 允许从系统 hooks 和服务的请求到本地网络。
allow_local_requests_from_web_hooks_and_services boolean no 允许从 Webhook 和集成的请求到本地网络。
allow_runner_registration_token boolean no 允许使用注册令牌创建 Runner。默认为 true
archive_builds_in_human_readable string no 设置作业的存活时间,之后被认为陈旧和过期,过了时间设定后,作业被归档并且不能再被重试执行。设置为空,则作业永不过期。时间不能短于一天,例如 15 days1 month2 years
asset_proxy_enabled boolean no (如果启用, 邀请填写: asset_proxy_url) 启用资源代理模式。极狐GitLab 需要重启使其生效。
asset_proxy_secret_key string no 与资源代理服务器共享密钥。极狐GitLab 需要重启使其生效。
asset_proxy_url string no 资源代理服务器地址。极狐GitLab 需要重启使其生效。
asset_proxy_whitelist string or array of strings no (弃用: 使用 asset_proxy_allowlist 代替) 匹配的这些域名的资源不会被代理。允许使用通配符。您的极狐GitLab 安装的链接自动被允许。极狐GitLab 需要重启使其生效。
asset_proxy_allowlist string or array of strings no 匹配的这些域名的资源不会被代理。允许使用通配符。您的极狐GitLab 安装的链接自动被允许。极狐GitLab 需要重启使其生效。
authorized_keys_enabled boolean no 默认情况下,我们通过写入到 authorized_keys 文件中,来支持 Git / SSH,不需要增加额外的配置。极狐GitLab 已优化到能通过数据库文件来认证 SSH keys。只有当您配置 OpenSSH 服务器,使用 AuthorizedKeysCommand 时,才关闭它。
auto_devops_domain string no 为每个项目的自动审查程序和自动部署环境,指定一个默认的域名。
auto_devops_enabled boolean no 默认为每个项目启用 DevOps。根据预先定义的 CI/CD 配置,它会自动的运行构建、测试、和部署应用程序。
automatic_purchased_storage_allocation boolean no 允许在命名空间中自动分配所购买的存储空间。
bulk_import_enabled boolean no 通过直接传输启用迁移极狐GitLab 群组。 引入于极狐GitLab 15.8。设置在管理中心中也可用
can_create_group boolean no 指示用户是否可以创建顶级群组。引入于极狐GitLab 15.5,默认为 true
check_namespace_plan boolean no 只有项目的命名空间的许可证方案包含这个功能,或者项目是公开的,可以打开这个设置。
ci_max_includes integer no 每个流水线的最多 includes 的数量。默认为 150
commit_email_hostname string no 自定义主机名(对于私有提交的邮箱)。
container_expiration_policies_enable_historic_entries boolean no 启用清理策略,对所有项目。
container_registry_cleanup_tags_service_max_list_size integer no 单次执行清理策略时能被清除最大数量的标签。
container_registry_delete_tags_service_timeout integer no 执行清理策略批量删除标签的最长时间,以秒为单位。
container_registry_expiration_policies_caching boolean no 执行清理策略期间是否启用缓存。
container_registry_expiration_policies_worker_capacity integer no 执行清理策略的线程数。
container_registry_token_expire_delay integer no 容器镜像库的 token 存活时间,以分钟为单位。
package_registry_cleanup_policies_worker_capacity integer no 分配给包清理策略的 worker 的数量。
deactivate_dormant_users boolean no 启用自动停用休眠的用户
deactivate_dormant_users_period integer no 用户被视为休眠的时间长度(以天为单位)。引入于极狐GitLab 15.3。
default_artifacts_expire_in string no 设置每个作业产物的默认过期时间。
default_branch_name string no 实例级别自定义初始化分支名称(引入于 13.2 版本)。
default_branch_protection integer no 控制开发人员是否可以推送到默认分支。可以取:0 (不受保护,具有开发者角色或维护者角色的用户都可以推送新的提交和强制推送)1 (部分保护,具有开发者角色或维护者角色的用户可以推送新的提交,但不能强制推送)2 (完全受保护,不具有开发者或维护者角色的用户无法推送新的提交,但具有开发者或维护者角色的用户可以;没有人可以强制推送) 作为参数。默认值为:2
default_ci_config_path string no 新项目的默认 CI/CD 配置文件名称以及路径(如果 .gitlab-ci.yml 没有设置的话)。
default_group_visibility string no 新建群组的可见性级别。可以设置 private, internalpublic 作为参数。默认是 private
default_preferred_language string no 未登录用户的默认语言。
default_project_creation integer no 默认在群组中创建项目的保护权限. 可以取: 0 (任何人都无法创建)1 (维护者)2 (开发者和维护者)
default_project_visibility string no 默认项目的可见性。可以取: privateinternalpublic 作为参数。默认是:private
default_projects_limit integer no 每个用户创建项目的限制的个数。 默认是: 100000
default_snippet_visibility string no 新建代码片段的可见性。 可以是: private, internalpublic 作为参数。默认是:private
default_syntax_highlighting_theme integer no 新用户和未登录用户的默认语法突出显示主题D。请参见可用主题 ID
delayed_project_deletion boolean no 在新群组中启用默认延迟删除项目。默认是:false。从 15.1 版本开始,只有当 delayed_group_deletion 设置为 true 的时候才能启用。从 15.11 开始,启用功能标志 always_perform_delayed_deletion 后,此参数被移除。此参数在 16.0 中会被完全移除。
delayed_group_deletion boolean no 启用延迟删除群组。默认是:true。引入于 15.0 版本。从 15.1 版本开始,当设置为 false 时,禁用并锁定群组级别的延迟保护删除。从 15.11 开始,启用功能标志 always_perform_delayed_deletion 后,此参数被移除。此参数在 16.0 中会被完全移除。
default_project_deletion_protection boolean no 启用默认项目删除保护,这样只有管理员能删除项目。默认为 false
delete_unconfirmed_users boolean no 指定是否应删除未确认电子邮件的客户。默认为 false。当设置为 true,未确认的用户会在 unconfirmed_users_delete_after_days 天后删除。引入于极狐GitLab 16.1。
deletion_adjourned_period integer no 删除标记为要删除的项目或群组等待的天数。值必须在 190 之间。默认是 7。从 15.1 版本开始,deletion_adjourned_period 的回调每次更新设置周期为 1,并且如果周期为 0 时,delayed_project_deletiondelayed_group_deletion 设置为 false
diagramsnet_enabled boolean no (如果启用,需要 diagramsnet_url)。默认为 true
diagramsnet_url string diagramsnet_enabled 需要 集成的 Diagrams.net 实例 URL。
diff_max_patch_bytes integer no 最大比较补丁大小的字节数。
diff_max_files integer no 最大一次文件对比的文件数
diff_max_lines integer no 最大一次对比的行数
disable_admin_oauth_scopes boolean no 阻止管理员将他们的极狐GitLab 账户连接到具有 apiread_apiread_repositorywrite_repositoryread_registrywrite_registrysudo 范围的不受信任的 OAuth 2.0 应用程序。引入于极狐GitLab 15.6。
disable_feed_token boolean no 不显示 RSS/Atom 和日历订阅 tokens(引入于 13.7 版本)。
disable_personal_access_token boolean no 禁用个人访问令牌。引入于极狐GitLab 15.7。
disabled_oauth_sign_in_sources array of strings no 关闭 OAuth 登录源。
dns_rebinding_protection_enabled boolean no 强制执行 DNS 重新绑定来攻击保护。
domain_denylist_enabled boolean no (如果启用, 需要填写:domain_denylist) 禁用从指定域名的邮箱注册用户。
domain_denylist array of strings no 电子邮件地址与这些域名匹配的用户无法注册。允许使用通配符。对多个条目使用单独的行。例如:domain.com*.domain.com
domain_allowlist array of strings no 强制用户仅使用指定域名的电子邮件进行注册。默认为 null,表示没有限制。
dsa_key_restriction integer no 上传的 DSA 密钥的最小允许位长度。默认是 0 (没有限制)。-1 禁用 DSA 密钥。
ecdsa_key_restriction integer no 上传的 ECDSA 密钥的最小允许长度(以比特为单位)。默认是:0 (没有限制)。-1 禁用 ECDSA 密钥 。
ecdsa_sk_key_restriction integer no 上传的 ECDSA_SK 密钥的最小允许长度(以比特为单位)。默认是:0 (没有限制)。-1 禁用 ECDSA_SK 密钥 。
ed25519_key_restriction integer no 上传的 ED25519 密钥的最小允许长度(以比特为单位)。默认是:0 (没有限制)。-1 禁用 ED25519 密钥 。
ed25519_sk_key_restriction integer no 上传的 ED25519_SK 密钥的最小允许长度(以比特为单位)。默认是:0 (没有限制)。-1 禁用 ED25519_SK 密钥。
eks_access_key_id string no AWS IAM 访问密钥 ID。
eks_account_id string no Amazon 账户 ID。
eks_integration_enabled boolean no 允许集成 Amazon EKS.
eks_secret_access_key string no AWS IAM secret 访问密钥。
elasticsearch_aws_access_key string no AWS IAM 访问密钥
elasticsearch_aws_region string no Elasticsearch 域名在 AWS 区域的配置。
elasticsearch_aws_secret_access_key string no AWS IAM secret 访问密钥。
elasticsearch_aws boolean no 允许使用在 AWS 部署的 Elasticsearch。
elasticsearch_indexed_field_length_limit integer no Elasticsearch 索引的文本字段的最大大小。0 值表示没有限制。不适用于仓库和 Wiki 索引。
elasticsearch_indexed_file_size_limit_kb integer no Elasticsearch 索引的仓库和 Wiki 文件的最大大小。
elasticsearch_indexing boolean no 启用 Elasticsearch 索引。
elasticsearch_requeue_workers boolean no 启用索引 worker 的自动重新排队机制通过将 Sidekiq 作业排入队列直到处理完所有文档来提高非代码索引吞吐量。
elasticsearch_limit_indexing boolean no 限制 Elasticsearch 索引某些命名空间和项目。
elasticsearch_max_bulk_concurrency integer no 每个索引操作的 Elasticsearch 批量请求的最大并发数。仅适用于仓库索引操作。
elasticsearch_worker_number_of_shards integer no 索引 worker 分片的数量。通过对更多并行 Sidekiq 作业进行排队来提高非代码索引吞吐量。默认为 2
elasticsearch_max_bulk_size_mb integer no Elasticsearch 批量索引请求的最大大小(以 MB 为单位)。仅适用于仓库索引操作。
elasticsearch_namespace_ids array of integers no 如果启用了 elasticsearch_limit_indexing,表示通过 Elasticsearch 索引的命名空间。
elasticsearch_project_ids array of integers no 如果启用了 elasticsearch_limit_indexing,表示通过 Elasticsearch 索引的项目。
elasticsearch_search boolean no 启用 Elasticsearch 搜索。
elasticsearch_url string no 用于连接到 Elasticsearch 的 URL。使用逗号分隔的列表来支持集群(例如,http://localhost:9200, http://localhost:9201")。
elasticsearch_username string no 您的 Elasticsearch 实例的 username
elasticsearch_password string no 您的 Elasticsearch 实例的密码。
email_additional_text string no 出于法律/审计/合规原因,在每封电子邮件的底部添加附加文本。
email_author_in_body boolean no 某些电子邮件服务器不支持覆盖电子邮件发件人姓名。启用此选项,在电子邮件正文中包含议题、合并请求或评论的作者姓名。
email_confirmation_setting string no 指定用户是否必须在登录前确认其电子邮件。可能的值为 offsofthard
enabled_git_access_protocol string no 启用 Git 访问协议。允许的值为:sshhttp 和允许这两种协议的 nil
enforce_namespace_storage_limit boolean no 启用此功能可以强制实施命名空间存储限制。
enforce_terms boolean no 如果启用,需要:terms)对所有用户强制执行应用程序服务条款。
external_auth_client_cert string no 如果启用,需要:external_auth_client_key)用于通过外部授权服务进行身份验证的证书。
external_auth_client_key_pass string no 与外部服务进行身份验证时用于私钥的密码短语,在存储时会被加密。
external_auth_client_key string external_auth_client_cert 需要 外部授权服务需要认证时证书的私钥,存储时加密。
external_authorization_service_default_label string external_authorization_service_enabled 需要 请求授权时使用的默认分类标签,项目上未指定分类标签。
external_authorization_service_enabled boolean no 如果启用,需要: external_authorization_service_default_labelexternal_authorization_service_timeoutexternal_authorization_service_url)启用使用外部授权服务访问项目。
external_authorization_service_timeout float external_authorization_service_enabled 需要 中止授权请求的超时时间,以秒为单位。当请求超时时,拒绝用户访问。(最小值:0.001,最大值:10,步长:0.001)。
external_authorization_service_url string external_authorization_service_enabled 需要 授权请求指向的 URL。
external_pipeline_validation_service_url string no 用于流水线验证请求的 URL。
external_pipeline_validation_service_token string no 可选。在对 external_pipeline_validation_service_url 中的 URL 的请求中作为 X-Gitlab-Token header 包含的令牌。
external_pipeline_validation_service_timeout integer no 等待流水线验证服务响应的时间。 如果超时,则假定 OK
file_template_project_id integer no 要从中加载自定义文件模板的项目的 ID。
first_day_of_week integer no 日历视图和日期选择器的开始日期。有效值:周日为 0(默认值),周一为 1,周六为 6
geo_node_allowed_ips string yes 允许的次要节点的 IP 和 CIDR 的逗号分隔列表。例如,1.1.1.1, 2.2.2.0/24
geo_status_timeout integer no 获取次要节点状态的请求超时后的秒数。
git_two_factor_session_expiry integer no 启用 2FA 时 Git 操作会话的最大持续时间(以分钟为单位)。
gitaly_timeout_default integer no 默认 Gitaly 超时,以秒为单位。对于 Git 提取/推送操作或 Sidekiq 作业,不会强制执行此超时。设置为 0,可以禁用超时。
gitaly_timeout_fast integer no Gitaly 快速操作超时,以秒为单位。一些 Gitaly 的操作预计会很快。如果它们超过此阈值,则存储分片可能存在问题,快速失败有助于维持实例的稳定性。设置为 0,可以禁用超时。
gitaly_timeout_medium integer no 中位 Gitaly 超时,以秒为单位。值应该在快速超时和默认超时之间的。设置为 0,可以禁用超时。
gitlab_dedicated_instance boolean no 标明实例是否为极狐GitLab Dedicated 提供。
grafana_enabled boolean no 启用 Grafana。
grafana_url string no Grafana URL。
gravatar_enabled boolean no 启用 Gravatar。
group_owners_can_manage_default_branch_protection boolean no 防止覆盖默认分支保护
hashed_storage_enabled boolean no 使用哈希存储路径创建新项目:启用不可变的、基于哈希的路径和仓库名称,将仓库存储在磁盘上。这可以防止在项目 URL 更改时必须移动或重命名仓库,并且可以提高磁盘 I/O 性能。(一直启用于 13.0及更高版本,14.0 版本计划移除配置)
help_page_hide_commercial_content boolean no 从帮助中隐藏与营销相关的条目。
help_page_support_url string no 帮助页面和帮助下拉列表的备用支持 URL。
help_page_text string no 帮助页面上显示的自定义文本。
help_text string no 已废弃:使用外观 API 中的 description 参数。在登录页面中自定义文本。
hide_third_party_offers boolean no 不要显示来自第三方优惠。
home_page_url string no 未登录时重定向到此 URL。
housekeeping_bitmaps_enabled boolean no 已废弃。Git 包文件位图创建始终处于启用状态,并且无法通过 API 和 UI 进行更改。始终返回 true
housekeeping_enabled boolean no 启用或禁用 Git 管理。需要设置其他字段。有关详细信息,请参阅 Housekeeping 字段
housekeeping_full_repack_period integer no 已废弃。运行增量 git repack 之后的 Git 推送次数。使用 housekeeping_optimize_repository_period 代替。有关详细信息,请参阅 Housekeeping 字段
housekeeping_gc_period integer no 已废弃。运行 git gc 之后的 Git 推送次数。使用 housekeeping_optimize_repository_period 代替。有关详细信息,请参阅 Housekeeping 字段
housekeeping_incremental_repack_period integer no 已废弃。运行增量 git repack 之后的 Git 推送次数。使用 housekeeping_optimize_repository_period 代替。有关详细信息,请参阅 Housekeeping 字段
housekeeping_optimize_repository_period integer no 运行增量 git repack 之后的 Git 推送次数。
html_emails_enabled boolean no 启用 HTML 电子邮件。
import_sources array of strings no 允许项目导入的来源,可能的值为 githubbitbucketbitbucket_serverfogbugzgitgitlab_projectgiteamanifest
in_product_marketing_emails_enabled boolean no 启用产品内营销电子邮件。默认启用。
invisible_captcha_enabled boolean no 在注册期间启用不可见的验证码垃圾邮件检测。默认禁用。
issues_create_limit integer no 每个用户每分钟的最大议题创建请求数。默认禁用。
keep_latest_artifact boolean no 防止从最近成功的作业中删除产物,无论到期时间如何。默认启用。
local_markdown_version integer no 当任何缓存的 Markdown 应该失效时增加这个值。
mailgun_signing_key string no Mailgun HTTP Webhook 签名密钥,用于从 Webhook 接收事件。
mailgun_events_enabled boolean no 启用 Mailgun 事件接收器。
maintenance_mode_message string no 实例处于维护模式时显示的消息。
maintenance_mode boolean no 当实例处于维护模式时,非管理员用户可以以只读访问权限登录并发出只读 API 请求。
max_artifacts_size integer no 最大产物大小(以 MB 为单位)。
max_attachment_size integer no 以 MB 为单位限制附件大小。
max_export_size integer no 以 MB 为单位的最大导出大小。0 表示无限制。默认值 = 0(无限制)。
max_import_size integer no 以 MB 为单位的最大导入大小。0 表示无限制。默认值 = 0(无限制)。于 13.8 版本开始,从 50 MB 修改为 0。
max_pages_size integer no Pages 仓库的最大大小(以 MB 为单位)。
max_personal_access_token_lifetime integer no 访问令牌的最大允许生命周期(以天为单位)。如果为空,使用默认值 365;如果设置,则值不能大于 365。更改后,过期日期超出最大允许生命周期的现有访问令牌将被撤销。
max_ssh_key_lifetime integer no SSH 密钥的最大允许生存期(以天为单位)。引入于 14.6 版本。
max_terraform_state_size_bytes integer no Terraform 状态文件的最大大小(以字节为单位)。将此设置为 0 以获得无限的文件大小。
metrics_method_call_threshold integer no 仅当方法调用花费的时间超过给定的毫秒数时,才会跟踪该方法调用。
max_number_of_repository_downloads integer no 用户在被禁止之前的指定时间段内可以下载的唯一仓库的最大数量。默认值:0,最大值:10,000 个仓库。引入于极狐GitLab 15.1。
max_number_of_repository_downloads_within_time_period integer no 报告时间段(以秒为单位)。默认值:0,最大值:864000 秒(10 天)。引入于极狐GitLab 15.1。
max_yaml_depth integer no 使用 include 关键字 添加的嵌套 CI/CD 配置的最大深度。默认为 100
max_yaml_size_bytes integer no 单个 CI/CD 配置文件的最大大小(以字节为单位)。默认为 1048576
git_rate_limit_users_allowlist array of strings no 从 Git 反滥用率限制中排除的用户名列表。默认值:[],最大值:100 个用户名。引入于极狐GitLab 15.2。
git_rate_limit_users_alertlist array of integers no 超过 Git 滥用率限制时通过电子邮件发送的用户 ID 列表。默认值:[],最大值:100 个用户 ID。引入于极狐GitLab 15.9。
auto_ban_user_on_excessive_projects_download boolean no 启用后,当用户在 max_number_of_repository_downloadsmax_number_of_repository_downloads_within_time_period 分别指定的时间段内下载超过最大数量的唯一项目时,他们将被自动禁止使用应用程序。引入于极狐GitLab 15.4。
mirror_available boolean no 允许项目维护者配置仓库镜像。如果禁用,则只有管理员可以配置仓库镜像。
mirror_capacity_threshold integer no 抢先调度更多镜像之前可用的最小容量。
mirror_max_capacity integer no 可以同时同步镜像的最大数量。
mirror_max_delay integer no 计划同步时,镜像可以具有的更新之间的最长时间(以分钟为单位)。
maven_package_requests_forwarding boolean no 当在 Maven 的极狐GitLab 包镜像库中找不到包时,使用 repo.maven.apache.org 作为默认远端仓库
npm_package_requests_forwarding boolean no 当在极狐GitLab 软件包库中找不到 npm 包时,使用 npmjs.org 作为默认远端仓库。
pypi_package_requests_forwarding boolean no 当在极狐GitLab 软件包库中找不到 PyPI 包时,使用 pypi.org 作为默认远端仓库。
outbound_local_requests_whitelist array of strings no 定义当本地对 Webhook 和集成的请求被禁用时,允许本地请求的受信任域或 IP 地址的列表。
pages_domain_verification_enabled boolean no 要求用户证明自定义域名的所有权。域名验证是公开站点的一项基本安全措施。用户必须证明他们在启用域名之前控制了域名。
password_authentication_enabled_for_git boolean no 通过极狐GitLab 账户密码启用基于 HTTP(S) 的 Git 身份验证。默认为 true
password_authentication_enabled_for_web boolean no 通过极狐GitLab 账户密码启用 Web 界面的身份验证。默认为 true
password_number_required boolean no 指示密码是否需要至少一个数字。引入于 15.1 版本。
password_symbol_required boolean no 指示密码是否需要至少一个符号字符。引入于 15.1 版本。
password_uppercase_required boolean no 指示密码是否至少需要一个大写字母。引入于 15.1 版本。
password_lowercase_required boolean no 指示密码是否至少需要一个小写字母。引入于 15.1 版本。
performance_bar_allowed_group_id string no (已弃用:改用 performance_bar_allowed_group_path)允许切换性能栏的群组的路径。
performance_bar_allowed_group_path string no 允许切换性能栏的群组的路径。
performance_bar_enabled boolean no (已弃用:改为传递 performance_bar_allowed_group_path: nil)允许启用性能栏。
personal_access_token_prefix string no 所有生成的个人访问令牌的前缀。
phone_verification_code_enabled boolean no 启用电话验证码验证。
pipeline_limit_per_project_user_sha integer no 每个用户和提交每分钟的最大流水线创建请求数。默认禁用。
plantuml_enabled boolean no 如果启用,需要: plantuml_url)启用 PlantUML 集成。默认为 false
plantuml_url string plantuml_enabled 需要 用于集成的 PlantUML 实例 URL。
polling_interval_multiplier decimal no 执行轮询的端点使用的间隔乘数。设置为 0 以禁用轮询。
project_export_enabled boolean no 启用项目导出。
projects_api_rate_limit_unauthenticated integer no 引入于 15.10。每个 IP 地址每 10 分钟对列出所有项目 API 的未经身份验证的最大请求数。默认值:400。要禁用 throttling,设置为 0。
prometheus_metrics_enabled boolean no 启用 Prometheus 指标。
protected_ci_variables boolean no CI/CD 变量默认受保护。
push_event_activities_limit integer no 单次推送中的最大更改(分支或标签)数量,超过该数量将创建批量推送事件。设置为 0 不会禁用限制。
push_event_hooks_limit integer no 单次推送中的最大更改(分支或标签)数量,超过该数量则不会触发 Webhook 和集成。设置为 0 不会禁用限制。
rate_limiting_response_text string no 当通过 throttle_* 设置启用速率限制时,在超过速率限制时发送此纯文本响应。 如果为空,则发送 ‘Retry later’。
raw_blob_request_limit integer no 每个原始路径每分钟的最大请求数(默认为 300)。设置为 0 以禁用限制。
user_email_lookup_limit integer no caution 废弃于 14.9 版本,删除于 15.0 版本。替换为search_rate_limit。每分钟电子邮件查找的最大请求数。默认值:60。设置为 0 可以禁用。
search_rate_limit integer no 在经过身份验证时执行搜索的每分钟最大请求数。默认值:30。设置为 0 可以禁用。
search_rate_limit_unauthenticated integer no 未经身份验证时执行搜索的每分钟最大请求数。默认值:10。设置为 0 可以禁用。
recaptcha_enabled boolean no 如果启用,需要: recaptcha_private_keyrecaptcha_site_key)启用 reCAPTCHA。
recaptcha_private_key string recaptcha_enabled 需要 reCAPTCHA 的私钥。
recaptcha_site_key string recaptcha_enabled 需要 reCAPTCHA 的站点密钥。
receive_max_input_size integer no 最大推送大小 (MB)。
repository_checks_enabled boolean no 极狐GitLab 会定期在所有项目和 Wiki 仓库中运行 git fsck,查找静默磁盘损坏问题。
repository_size_limit integer no 每个仓库的大小限制 (MB)。
repository_storages_weighted hash of strings to integers no (13.1 及更高版本) 从 gitlab.yml 到权重的名称哈希。在其中之一创建新项目,通过加权随机选择进行选择。
repository_storages array of strings no (13.0 及更高版本) 已启用存储路径的名称列表,取自 gitlab.yml。在其中之一创建新项目,随机选择。
require_admin_approval_after_user_signup boolean no 启用后,使用注册表单来注册账户的任何用户都将处于待批准状态,并且必须由管理员明确批准
require_two_factor_authentication boolean no 如果启用,需要: two_factor_grace_period)要求所有用户设置双重身份验证。
restricted_visibility_levels array of strings no 非管理员用户不能将所选级别用于群组、项目或片段。 可以将 privateinternalpublic 作为参数。默认为 null,表示没有限制。
rsa_key_restriction integer no 上传的 RSA 密钥的最小允许位长度。默认为 0(无限制)。-1 禁用 RSA 密钥。
session_expire_delay integer no 会话持续时间(以分钟为单位)。需要重新启动极狐GitLab 才能应用更改。
security_policy_global_group_approvers_enabled boolean no 是否在全局或项目层次结构内查找扫描结果策略审批组。
shared_runners_enabled boolean no 如果启用,需要: shared_runners_textshared_runners_minutes)为新项目启用共享 runner。
shared_runners_minutes integer shared_runners_enabled 需要 设置群组每月可以在共享 runner 上使用的最大计算分钟。
shared_runners_text string shared_runners_enabled 需要 共享 runner 文本。
sidekiq_job_limiter_mode string no trackcompress。 设置 Sidekiq 作业大小限制的行为。默认值:compress
sidekiq_job_limiter_compression_threshold_bytes integer no Sidekiq 作业在存储到 Redis 之前被压缩的字节阈值。默认值:100 000 字节 (100 KB)。
sidekiq_job_limiter_limit_bytes integer no Sidekiq 作业被拒绝的字节阈值。默认值:0 字节(不拒绝任何作业)。
sign_in_text string no 已废弃:使用外观 API 中的 description 参数代替。登录页面上的自定义文本。
signin_enabled string no (已弃用:使用 password_authentication_enabled_for_web 代替)指示是否为 Web 界面启用密码身份验证的标志。
signup_enabled boolean no 启用注册。默认为 true
silent_mode_enabled boolean no 启用静默模式。默认为 false
slack_app_enabled boolean no 如果启用,需要:slack_app_idslack_app_secretslack_app_signing_secretslack_app_verification_token)启用 GitLab for Slack 应用程序。
slack_app_id string slack_app_enabled 需要 GitLab for Slack 应用的客户端 ID。
slack_app_secret string slack_app_enabled 需要 GitLab for Slack 的客户端 secret。用于验证来自应用程序的 OAuth 请求。
slack_app_signing_secret string no GitLab for Slack 应用程序的签名 secret。用于验证来自应用程序的 API 请求。
slack_app_verification_token string slack_app_enabled 需要 GitLab for Slack 的验证令牌。Slack 已经废弃了这种身份验证方法,仅用于验证来自应用程序的 slash 命令。
snippet_size_limit integer no 字节为单位的最大片段内容大小。默认值:52428800 字节 (50 MB)。
snowplow_app_id string no Snowplow 站点名称/应用程序 ID。(例如,gitlab
snowplow_collector_hostname string snowplow_enabled 需要 Snowplow 收集器主机名。(例如,snowplow.trx.gitlab.net
snowplow_cookie_domain string no Snowplow cookie 域名。(例如,.jihulab.com
snowplow_enabled boolean no 启用 snowplow 跟踪。
sourcegraph_enabled boolean no 启用 Sourcegraph 集成。默认为 false如果启用,需要 sourcegraph_url
sourcegraph_public_only boolean no 阻止 Sourcegraph 加载到私有和内部项目中。默认为 true
sourcegraph_url string sourcegraph_enabled 需要 用于集成的 Sourcegraph 实例 URL。
spam_check_endpoint_enabled boolean no 使用外部 Spam Check API 端点启用垃圾邮件检查。默认为 false
spam_check_endpoint_url string no 外部 Spamcheck 服务端点的 URL。有效的 URI 方案是 grpctls。指定 tls 会强制对通信进行加密。
spam_check_api_key string no 用于访问垃圾邮件检查服务端点的 API 密钥。
suggest_pipeline_enabled boolean no 启用流水线建议 banner。
terminal_max_session_time integer no Web 终端 websocket 连接的最长时间(以秒为单位)。设置为 0 表示无限时间。
terms text enforce_terms 需要 ToS 的 Markdown 内容。
throttle_authenticated_api_enabled boolean no 如果启用,需要: throttle_authenticated_api_period_in_secondsthrottle_authenticated_api_requests_per_period)启用经过身份验证的 API 请求速率限制。 帮助减少请求量(例如,来自爬虫或滥用机器人)。
throttle_authenticated_api_period_in_seconds integer throttle_authenticated_api_enabled 需要 速率限制期限(以秒为单位)。
throttle_authenticated_api_requests_per_period integer throttle_authenticated_api_enabled 需要 每个用户每个时期的最大请求数。
throttle_authenticated_packages_api_enabled boolean no 如果启用,需要: throttle_authenticated_packages_api_period_in_secondsthrottle_authenticated_packages_api_requests_per_period)启用经过身份验证的 API 请求速率限制。帮助减少请求量(例如,来自爬虫或滥用机器人)。查看软件包库速率限制了解更多详情。
throttle_authenticated_packages_api_period_in_seconds integer throttle_authenticated_packages_api_enabled 需要 速率限制期限(以秒为单位)。查看软件包库速率限制了解更多详情。
throttle_authenticated_packages_api_requests_per_period integer throttle_authenticated_packages_api_enabled 需要 每个用户每个时期的最大请求数。查看软件包库速率限制了解更多详情。
throttle_authenticated_web_enabled boolean no 如果启用,需要: throttle_authenticated_web_period_in_secondsthrottle_authenticated_web_requests_per_period)启用经过身份验证的 Web 请求速率限制。 帮助减少请求量(例如,来自爬虫或滥用机器人)。
throttle_authenticated_web_period_in_seconds integer throttle_authenticated_web_enabled 需要 速率限制期限(以秒为单位)。
throttle_authenticated_web_requests_per_period integer throttle_authenticated_web_enabled 需要 每个用户每个时期的最大请求数。
throttle_unauthenticated_enabled boolean no (废弃于 14.3 版本。使用 throttle_unauthenticated_web_enabledthrottle_unauthenticated_api_enabled 代替。) (如果启用,需要: throttle_unauthenticated_period_in_secondsthrottle_unauthenticated_requests_per_period)启用未经身份验证的 Web 请求速率限制。帮助减少请求量(例如,来自爬虫或滥用机器人)。
throttle_unauthenticated_period_in_seconds integer throttle_unauthenticated_enabled 需要 (废弃于 14.3 版本。使用 throttle_unauthenticated_web_period_in_secondsthrottle_unauthenticated_api_period_in_seconds 代替。)速率限制时间以秒为单位。
throttle_unauthenticated_requests_per_period integer throttle_unauthenticated_enabled 需要 (废弃于 14.3 版本。使用 throttle_unauthenticated_web_requests_per_periodthrottle_unauthenticated_api_requests_per_period 代替。)每个 IP 每个周期的最大请求数。
throttle_unauthenticated_api_enabled boolean no 如果启用,需要: throttle_unauthenticated_api_period_in_secondsthrottle_unauthenticated_api_requests_per_period)启用未经身份验证的 API 请求速率限制。 帮助减少请求量(例如,来自爬虫或滥用机器人)。
throttle_unauthenticated_api_period_in_seconds integer throttle_unauthenticated_api_enabled 需要 速率限制时间以秒为单位。
throttle_unauthenticated_api_requests_per_period integer throttle_unauthenticated_api_enabled 需要 每个 IP 每个周期的最大请求数。
throttle_unauthenticated_packages_api_enabled boolean no 如果启用,需要: throttle_unauthenticated_packages_api_period_in_secondsthrottle_unauthenticated_packages_api_requests_per_period)启用经过身份验证的 API 请求速率限制。帮助减少请求量(例如,来自爬虫或滥用机器人)。查看软件包库速率限制了解更多详情。
throttle_unauthenticated_packages_api_period_in_seconds integer throttle_unauthenticated_packages_api_enabled 需要 速率限制期限(以秒为单位)。查看软件包库速率限制了解更多详情。
throttle_unauthenticated_packages_api_requests_per_period integer throttle_unauthenticated_packages_api_enabled 需要 每个用户每个时期的最大请求数。查看软件包库速率限制了解更多详情。
throttle_unauthenticated_web_enabled boolean no 如果启用,需要: throttle_unauthenticated_web_period_in_secondsthrottle_unauthenticated_web_requests_per_period)启用未经身份验证的 Web 请求速率限制。 帮助减少请求量(例如,来自爬虫或滥用机器人)。
throttle_unauthenticated_web_period_in_seconds integer throttle_unauthenticated_web_enabled 需要 速率限制时间以秒为单位。
throttle_unauthenticated_web_requests_per_period integer throttle_unauthenticated_web_enabled 需要 每个 IP 每个周期的最大请求数。
time_tracking_limit_to_hours boolean no 将时间跟踪单位的显示限制为小时。默认为 false
two_factor_grace_period integer require_two_factor_authentication 需要 允许用户跳过双重身份验证的强制配置的时间量(以小时为单位)。
unconfirmed_users_delete_after_days integer no 指定注册后多少天删除尚未确认电子邮件的用户。仅当 delete_unconfirmed_users 设置为 true 时才适用。必须为 1 或更大。默认值为 7。引入于极狐GitLab 16.1。
unique_ips_limit_enabled boolean no 如果启用,需要: unique_ips_limit_per_userunique_ips_limit_time_window)限制从多个 IP 登录。
unique_ips_limit_per_user integer unique_ips_limit_enabled 需要 每个用户的最大 IP 数。
unique_ips_limit_time_window integer unique_ips_limit_enabled 需要 IP 计入限制的秒数。
update_runner_versions_enabled boolean no 从 JihuLab.com 获取极狐GitLab Runner 发布版本数据。
usage_ping_enabled boolean no 每周极狐GitLab 都会向 JiHu(GitLab) 报告许可证使用情况。
user_deactivation_emails_enabled boolean no 在账户停用时向用户发送电子邮件。
user_default_external boolean no 新注册的用户默认为外部用户。
user_default_internal_regex string no 指定电子邮件地址正则表达式,识别默认内部用户。
user_defaults_to_private_profile boolean no 默认情况下,新创建的用户具有私有配置文件。引入于极狐GitLab 15.8。默认为 false
user_oauth_applications boolean no 允许用户注册任何应用程序,使用极狐GitLab 作为 OAuth 提供者。
user_show_add_ssh_key_message boolean no 当设置为“false”时,禁用向没有上传 SSH 密钥的用户显示的“您将无法通过 SSH 拉取或推送项目代码”警告。
version_check_enabled boolean no 当有可用更新时,让极狐GitLab 通知您。
valid_runner_registrars array of strings no 允许注册极狐GitLab Runner 的类型列表。可以是 []['group']['project']['group', 'project']
whats_new_variant string no 展示新功能变化,可能的值:all_tierscurrent_tierdisabled
wiki_page_max_content_bytes integer no 最大 Wiki 页面内容大小(以 字节 为单位)。默认值:52428800 字节 (50 MB)。最小值为 1024 字节。
jira_connect_application_key String no 用于通过极狐GitLab for Jira Cloud 应用程序进行身份验证的 OAuth 应用程序的应用程序 ID。
jira_connect_proxy_url String no 应该用作极狐GitLab for Jira Cloud 应用程序代理的极狐GitLab 实例的 URL。
gitlab_shell_operation_limit integer no 用户每分钟可以执行的最大 Git 操作数。默认为 600。引入于 16.2。

配置非活动项目删除

您可以配置非活动的项目删除或将其关闭。

参数 类型 是否必需 描述
delete_inactive_projects boolean no 启用非活动项目删除。默认为 false。引入于极狐GitLab 14.10。在极狐GitLab 15.4 中,在没有功能标志的情况下开始运行。
inactive_projects_delete_after_months integer no delete_inactive_projectstrue,删除非活跃项目前需要的等待时间(按月为单位。默认为 2。引入于极狐GitLab 14.10。可运行于极狐GitLab 15.0。
inactive_projects_min_size_mb integer no delete_inactive_projectstrue,要检查非活跃项目的最小仓库大小。默认为 0。引入于极狐GitLab 14.10。可运行于极狐GitLab 15.0。
inactive_projects_send_warning_email_after_months integer no delete_inactive_projectstrue,设置因项目不活跃而计划删除项目,给维护者发邮件之前的等待时间(以月为单位)。默认为 1。引入于极狐GitLab 14.10。可运行于极狐GitLab 15.0。

Housekeeping 字段

**::Tabs

:::TabTitle 15.8 及更高版本

如果 housekeeping_optimize_repository_period 字段为整数,则在您指定的 Git 推送次数之后执行 housekeeping 操作。

:::TabTitle 15.7 及更高版本

housekeeping_enabled 字段启用或禁用 Git housekeeping。要正常运行,此字段需要设置 housekeeping_optimize_repository_period,或者设置这些以下所有值:

  • housekeeping_bitmaps_enabled
  • housekeeping_full_repack_period
  • housekeeping_gc_period

::EndTabs

软件包库:软件包文件大小限制

软件包文件大小限制不是应用程序设置 API 的一部分。 相反,可以使用计划限制 API 访问这些设置。