You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fix all possible setting error related storages and added some tests (#23911)
Follow up #22405Fix#20703
This PR rewrites storage configuration read sequences with some breaks
and tests. It becomes more strict than before and also fixed some
inherit problems.
- Move storage's MinioConfig struct into setting, so after the
configuration loading, the values will be stored into the struct but not
still on some section.
- All storages configurations should be stored on one section,
configuration items cannot be overrided by multiple sections. The
prioioty of configuration is `[attachment]` > `[storage.attachments]` |
`[storage.customized]` > `[storage]` > `default`
- For extra override configuration items, currently are `SERVE_DIRECT`,
`MINIO_BASE_PATH`, `MINIO_BUCKET`, which could be configured in another
section. The prioioty of the override configuration is `[attachment]` >
`[storage.attachments]` > `default`.
- Add more tests for storages configurations.
- Update the storage documentations.
---------
Co-authored-by: wxiaoguang <[email protected]>
;; Default address to get action plugins, e.g. the default value means downloading from "https://gitea.com/actions/checkout" for "uses: actions/checkout@v3"
-`STORAGE_TYPE`: **local**: Storage type, `local` for local disk or `minio` for s3 compatible object storage service.
1259
1260
-`SERVE_DIRECT`: **false**: Allows the storage driver to redirect to authenticated URLs to serve files directly. Currently, only Minio/S3 is supported via signed URLs, local does nothing.
1260
1261
-`MINIO_ENDPOINT`: **localhost:9000**: Minio endpoint to connect only available when `STORAGE_TYPE` is `minio`
1261
1262
-`MINIO_ACCESS_KEY_ID`: Minio accessKeyID to connect only available when `STORAGE_TYPE` is `minio`
@@ -1265,10 +1266,10 @@ Default storage configuration for attachments, lfs, avatars and etc.
1265
1266
-`MINIO_USE_SSL`: **false**: Minio enabled ssl only available when `STORAGE_TYPE` is `minio`
1266
1267
-`MINIO_INSECURE_SKIP_VERIFY`: **false**: Minio skip SSL verification available when STORAGE_TYPE is `minio`
1267
1268
1268
-
And you can also define a customize storage like below:
1269
+
The recommanded storage configuration for minio like below:
1269
1270
1270
1271
```ini
1271
-
[storage.my_minio]
1272
+
[storage]
1272
1273
STORAGE_TYPE = minio
1273
1274
; Minio endpoint to connect only available when STORAGE_TYPE is `minio`
1274
1275
MINIO_ENDPOINT = localhost:9000
@@ -1284,9 +1285,54 @@ MINIO_LOCATION = us-east-1
1284
1285
MINIO_USE_SSL = false
1285
1286
; Minio skip SSL verification available when STORAGE_TYPE is `minio`
1286
1287
MINIO_INSECURE_SKIP_VERIFY = false
1288
+
SERVE_DIRECT = true
1289
+
```
1290
+
1291
+
Defaultly every storage has their default base path like below
1292
+
1293
+
| storage | default base path |
1294
+
| ----------------- | ------------------ |
1295
+
| attachments | attachments/ |
1296
+
| lfs | lfs/ |
1297
+
| avatars | avatars/ |
1298
+
| repo-avatars | repo-avatars/ |
1299
+
| repo-archive | repo-archive/ |
1300
+
| packages | packages/ |
1301
+
| actions_log | actions_log/ |
1302
+
| actions_artifacts | actions_artifacts/ |
1303
+
1304
+
And bucket, basepath or `SERVE_DIRECT` could be special or overrided, if you want to use a different you can:
1305
+
1306
+
```ini
1307
+
[storage.actions_log]
1308
+
MINIO_BUCKET = gitea_actions_log
1309
+
SERVE_DIRECT = true
1310
+
MINIO_BASE_PATH = my_actions_log/ ; default is actions_log/ if blank
1287
1311
```
1288
1312
1289
-
And used by `[attachment]`, `[lfs]` and etc. as `STORAGE_TYPE`.
1313
+
If you want to customerize a different storage for `lfs` if above default storage defined
1314
+
1315
+
```ini
1316
+
[lfs]
1317
+
STORAGE_TYPE = my_minio
1318
+
1319
+
[storage.my_minio]
1320
+
STORAGE_TYPE = minio
1321
+
; Minio endpoint to connect only available when STORAGE_TYPE is `minio`
1322
+
MINIO_ENDPOINT = localhost:9000
1323
+
; Minio accessKeyID to connect only available when STORAGE_TYPE is `minio`
1324
+
MINIO_ACCESS_KEY_ID =
1325
+
; Minio secretAccessKey to connect only available when STORAGE_TYPE is `minio`
1326
+
MINIO_SECRET_ACCESS_KEY =
1327
+
; Minio bucket to store the attachments only available when STORAGE_TYPE is `minio`
1328
+
MINIO_BUCKET = gitea
1329
+
; Minio location to create bucket only available when STORAGE_TYPE is `minio`
1330
+
MINIO_LOCATION = us-east-1
1331
+
; Minio enabled ssl only available when STORAGE_TYPE is `minio`
1332
+
MINIO_USE_SSL = false
1333
+
; Minio skip SSL verification available when STORAGE_TYPE is `minio`
@@ -1306,6 +1352,11 @@ is `data/repo-archive` and the default of `MINIO_BASE_PATH` is `repo-archive/`.
1306
1352
-`MINIO_USE_SSL`: **false**: Minio enabled ssl only available when `STORAGE_TYPE` is `minio`
1307
1353
-`MINIO_INSECURE_SKIP_VERIFY`: **false**: Minio skip SSL verification available when STORAGE_TYPE is `minio`
1308
1354
1355
+
## Repository Archives (`repo-archive`)
1356
+
1357
+
-`STORAGE_TYPE`: **local**: Storage type for actions logs, `local` for local disk or `minio` for s3 compatible object storage service, default is `local` or other name defined with `[storage.xxx]`
1358
+
-`MINIO_BASE_PATH`: **repo-archive/**: Minio base path on the bucket only available when STORAGE_TYPE is `minio`
1359
+
1309
1360
## Proxy (`proxy`)
1310
1361
1311
1362
-`PROXY_ENABLED`: **false**: Enable the proxy if true, all requests to external via HTTP will be affected, if false, no proxy will be used even environment http_proxy/https_proxy
-`DEFAULT_ACTIONS_URL`: **https://gitea.com**: Default address to get action plugins, e.g. the default value means downloading from "<https://gitea.com/actions/checkout>" for "uses: actions/checkout@v3"
1378
+
-`STORAGE_TYPE`: **local**: Storage type for actions logs, `local` for local disk or `minio` for s3 compatible object storage service, default is `local` or other name defined with `[storage.xxx]`
1379
+
-`MINIO_BASE_PATH`: **actions_log/**: Minio base path on the bucket only available when STORAGE_TYPE is `minio`
1327
1380
1328
1381
`DEFAULT_ACTIONS_URL` indicates where should we find the relative path action plugin. i.e. when use an action in a workflow file like
0 commit comments