BigW Consortium Gitlab

settings.md 5.32 KB
Newer Older
1 2
# Application settings

3 4 5
These API calls allow you to read and modify GitLab instance application
settings as appear in `/admin/application_settings`. You have to be an
administrator in order to perform this action.
6

7
## Get current application settings
8

9
List the current application settings of the GitLab instance.
10 11 12 13 14

```
GET /application/settings
```

15
```bash
16
curl --header "PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK" https://gitlab.example.com/api/v3/application/settings
17 18 19 20
```

Example response:

21 22
```json
{
23 24 25 26 27 28 29 30 31 32 33 34 35
   "default_projects_limit" : 10,
   "signup_enabled" : true,
   "id" : 1,
   "default_branch_protection" : 2,
   "restricted_visibility_levels" : [],
   "signin_enabled" : true,
   "after_sign_out_path" : null,
   "max_attachment_size" : 10,
   "user_oauth_applications" : true,
   "updated_at" : "2016-01-04T15:44:55.176Z",
   "session_expire_delay" : 10080,
   "home_page_url" : null,
   "default_snippet_visibility" : 0,
36
   "domain_whitelist" : [],
37 38
   "domain_blacklist_enabled" : false,
   "domain_blacklist" : [],
39 40 41
   "created_at" : "2016-01-04T15:44:55.176Z",
   "default_project_visibility" : 0,
   "gravatar_enabled" : true,
42
   "sign_in_text" : null,
43
   "container_registry_token_expire_delay": 5,
44 45 46
   "repository_storage": "default",
   "koding_enabled": false,
   "koding_url": null
47 48 49
}
```

50
## Change application settings
51 52 53 54 55

```
PUT /application/settings
```

56 57 58 59 60 61 62 63
| Attribute | Type | Required | Description |
| --------- | ---- | :------: | ----------- |
| `default_projects_limit` | integer  | no | Project limit per user. Default is `10` |
| `signup_enabled`    | boolean | no  | Enable registration. Default is `true`. |
| `signin_enabled`    | boolean | no  | Enable login via a GitLab account. Default is `true`. |
| `gravatar_enabled`  | boolean | no  | Enable Gravatar |
| `sign_in_text`      | string  | no  | Text on login page |
| `home_page_url`     | string  | no  | Redirect to this URL when not logged in |
64
| `default_branch_protection` | integer | no | Determine if developers can push to master. Can take `0` _(not protected, both developers and masters can push new commits, force push or delete the branch)_, `1` _(partially protected, developers can push new commits, but cannot force push or delete the branch, masters can do anything)_ or `2` _(fully protected, developers cannot push new commits, force push or delete the branch, masters can do anything)_ as a parameter. Default is `2`. |
65 66 67 68 69
| `restricted_visibility_levels` | array of integers | no | Selected levels cannot be used by non-admin users for projects or snippets. Can take `0` _(Private)_, `1` _(Internal)_ and `2` _(Public)_ as a parameter. Default is null which means there is no restriction. |
| `max_attachment_size` | integer | no | Limit attachment size in MB |
| `session_expire_delay` | integer | no | Session duration in minutes. GitLab restart is required to apply changes |
| `default_project_visibility` | integer | no | What visibility level new projects receive. Can take `0` _(Private)_, `1` _(Internal)_ and `2` _(Public)_ as a parameter. Default is `0`.|
| `default_snippet_visibility` | integer | no | What visibility level new snippets receive. Can take `0` _(Private)_, `1` _(Internal)_ and `2` _(Public)_ as a parameter. Default is `0`.|
70
| `domain_whitelist` | array of strings | no | Force people to use only corporate emails for sign-up. Default is null, meaning there is no restriction. |
71
| `domain_blacklist_enabled` | boolean | no | Enable/disable the `domain_blacklist` |
72
| `domain_blacklist` | array of strings | yes (if `domain_blacklist_enabled` is `true`) | People trying to sign-up with emails from this domain will not be allowed to do so. |
73 74
| `user_oauth_applications` | boolean | no | Allow users to register any application to use GitLab as an OAuth provider |
| `after_sign_out_path` | string | no | Where to redirect users after logout |
75
| `container_registry_token_expire_delay` | integer | no | Container Registry token duration in minutes |
76
| `repository_storage` | string | no | Storage path for new projects. The value should be the name of one of the repository storage paths defined in your gitlab.yml |
77 78 79
| `enabled_git_access_protocol` | string | no | Enabled protocols for Git access. Allowed values are: `ssh`, `http`, and `nil` to allow both protocols. |
| `koding_enabled` | boolean | no | Enable Koding integration. Default is `false`. |
| `koding_url` | string | yes (if `koding_enabled` is `true`) |  The Koding instance URL for integration. |
80

81
```bash
82
curl --request PUT --header "PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK" https://gitlab.example.com/api/v3/application/settings?signup_enabled=false&default_project_visibility=1
83
```
84

85
Example response:
86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101

```json
{
  "id": 1,
  "default_projects_limit": 10,
  "signup_enabled": true,
  "signin_enabled": true,
  "gravatar_enabled": true,
  "sign_in_text": "",
  "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,
  "session_expire_delay": 10080,
102
  "default_project_visibility": 1,
103
  "default_snippet_visibility": 0,
104
  "domain_whitelist": [],
105 106
  "domain_blacklist_enabled" : false,
  "domain_blacklist" : [],
107
  "user_oauth_applications": true,
108
  "after_sign_out_path": "",
109
  "container_registry_token_expire_delay": 5,
110 111 112
  "repository_storage": "default",
  "koding_enabled": false,
  "koding_url": null
113 114
}
```