BigW Consortium Gitlab

settings.md 7.36 KB
Newer Older
1
# Application settings API
2

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/v4/application/settings
17 18 19 20
```

Example response:

21 22
```json
{
23
   "default_projects_limit" : 100000,
24 25 26 27
   "signup_enabled" : true,
   "id" : 1,
   "default_branch_protection" : 2,
   "restricted_visibility_levels" : [],
28
   "password_authentication_enabled" : true,
29 30 31 32 33 34
   "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,
35
   "default_snippet_visibility" : "private",
36
   "domain_whitelist" : [],
37 38
   "domain_blacklist_enabled" : false,
   "domain_blacklist" : [],
39
   "created_at" : "2016-01-04T15:44:55.176Z",
40 41
   "default_project_visibility" : "private",
   "default_group_visibility" : "private",
42
   "gravatar_enabled" : true,
43
   "sign_in_text" : null,
44
   "container_registry_token_expire_delay": 5,
45
   "repository_storages": ["default"],
46
   "koding_enabled": false,
47 48
   "koding_url": null,
   "plantuml_enabled": false,
49
   "plantuml_url": null,
50
   "terminal_max_session_time": 0,
51
   "polling_interval_multiplier": 1.0,
52 53 54 55
   "rsa_key_restriction": 0,
   "dsa_key_restriction": 0,
   "ecdsa_key_restriction": 0,
   "ed25519_key_restriction": 0,
56 57 58
}
```

59
## Change application settings
60 61 62 63 64

```
PUT /application/settings
```

65 66
| Attribute | Type | Required | Description |
| --------- | ---- | :------: | ----------- |
67
| `default_projects_limit` | integer  | no | Project limit per user. Default is `100000` |
68
| `signup_enabled`    | boolean | no  | Enable registration. Default is `true`. |
69
| `password_authentication_enabled`    | boolean | no  | Enable authentication via a GitLab account password. Default is `true`. |
70 71 72
| `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 |
73
| `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`. |
74
| `restricted_visibility_levels` | array of strings | no | Selected levels cannot be used by non-admin users for projects or snippets. Can take `private`, `internal` and `public` as a parameter. Default is null which means there is no restriction. |
75 76
| `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 |
77 78 79
| `default_project_visibility` | string | no | What visibility level new projects receive. Can take `private`, `internal` and `public` as a parameter. Default is `private`.|
| `default_snippet_visibility` | string | no | What visibility level new snippets receive. Can take `private`, `internal` and `public` as a parameter. Default is `private`.|
| `default_group_visibility` | string | no | What visibility level new groups receive. Can take `private`, `internal` and `public` as a parameter. Default is `private`.|
80
| `domain_whitelist` | array of strings | no | Force people to use only corporate emails for sign-up. Default is null, meaning there is no restriction. |
81
| `domain_blacklist_enabled` | boolean | no | Enable/disable the `domain_blacklist` |
82
| `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. |
83 84
| `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 |
85
| `container_registry_token_expire_delay` | integer | no | Container Registry token duration in minutes |
86
| `repository_storages` | array of strings | no | A list of names of enabled storage paths, taken from `gitlab.yml`. New projects will be created in one of these stores, chosen at random. |
87 88 89
| `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. |
90
| `disabled_oauth_sign_in_sources` | Array of strings | no | Disabled OAuth sign-in sources |
91 92
| `plantuml_enabled` | boolean | no | Enable PlantUML integration. Default is `false`. |
| `plantuml_url` | string | yes (if `plantuml_enabled` is `true`) |  The PlantUML instance URL for integration. |
93
| `terminal_max_session_time` | integer | no | Maximum time for web terminal websocket connection (in seconds). Set to 0 for unlimited time. |
94
| `polling_interval_multiplier` | decimal | no | Interval multiplier used by endpoints that perform polling. Set to 0 to disable polling. |
95 96 97 98
| `rsa_key_restriction` | integer | no | The minimum allowed bit length of an uploaded RSA key. Default is `0` (no restriction). `-1` disables RSA keys.
| `dsa_key_restriction` | integer | no | The minimum allowed bit length of an uploaded DSA key. Default is `0` (no restriction). `-1` disables DSA keys.
| `ecdsa_key_restriction` | integer | no | The minimum allowed curve size (in bits) of an uploaded ECDSA key. Default is `0` (no restriction). `-1` disables ECDSA keys.
| `ed25519_key_restriction` | integer | no | The minimum allowed curve size (in bits) of an uploaded ED25519 key. Default is `0` (no restriction). `-1` disables ED25519 keys.
99

100
```bash
101
curl --request PUT --header "PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK" https://gitlab.example.com/api/v4/application/settings?signup_enabled=false&default_project_visibility=internal
102
```
103

104
Example response:
105 106 107 108

```json
{
  "id": 1,
109
  "default_projects_limit": 100000,
110
  "signup_enabled": true,
111
  "password_authentication_enabled": true,
112 113 114 115 116 117 118 119 120
  "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,
121 122 123
  "default_project_visibility": "internal",
  "default_snippet_visibility": "private",
  "default_group_visibility": "private",
124
  "domain_whitelist": [],
125 126
  "domain_blacklist_enabled" : false,
  "domain_blacklist" : [],
127
  "user_oauth_applications": true,
128
  "after_sign_out_path": "",
129
  "container_registry_token_expire_delay": 5,
130
  "repository_storages": ["default"],
131
  "koding_enabled": false,
132 133
  "koding_url": null,
  "plantuml_enabled": false,
134
  "plantuml_url": null,
135
  "terminal_max_session_time": 0,
136
  "polling_interval_multiplier": 1.0,
137 138 139 140
  "rsa_key_restriction": 0,
  "dsa_key_restriction": 0,
  "ecdsa_key_restriction": 0,
  "ed25519_key_restriction": 0,
141 142
}
```