Skip to content

Commit

Permalink
Change MINIO_LOOKUP_TYPE to MINIO_BUCKET_LOOKUP_TYPE, make it more pr…
Browse files Browse the repository at this point in the history
…ecise.
  • Loading branch information
dicarne committed May 14, 2024
1 parent 016a884 commit 792a9c3
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 19 deletions.
4 changes: 2 additions & 2 deletions custom/conf/app.example.ini
Original file line number Diff line number Diff line change
Expand Up @@ -1897,7 +1897,7 @@ LEVEL = Info
;MINIO_CHECKSUM_ALGORITHM = default
;;
;; Minio bucket lookup method defaults to auto mode; set it to `dns` for virtual host style or `path` for path style, only available when STORAGE_TYPE is `minio`
;MINIO_LOOKUP_TYPE = auto
;MINIO_BUCKET_LOOKUP_TYPE = auto

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Expand Down Expand Up @@ -2581,7 +2581,7 @@ LEVEL = Info
;MINIO_INSECURE_SKIP_VERIFY = false
;;
;; Minio bucket lookup method defaults to auto mode; set it to `dns` for virtual host style or `path` for path style, only available when STORAGE_TYPE is `minio`
;MINIO_LOOKUP_TYPE = auto
;MINIO_BUCKET_LOOKUP_TYPE = auto

;[proxy]
;; Enable the proxy, all requests to external via HTTP will be affected
Expand Down
12 changes: 6 additions & 6 deletions docs/content/administration/config-cheat-sheet.en-us.md
Original file line number Diff line number Diff line change
Expand Up @@ -851,7 +851,7 @@ Default templates for project boards:
- `MINIO_USE_SSL`: **false**: Minio enabled ssl only available when STORAGE_TYPE is `minio`
- `MINIO_INSECURE_SKIP_VERIFY`: **false**: Minio skip SSL verification available when STORAGE_TYPE is `minio`
- `MINIO_CHECKSUM_ALGORITHM`: **default**: Minio checksum algorithm: `default` (for MinIO or AWS S3) or `md5` (for Cloudflare or Backblaze)
- `MINIO_LOOKUP_TYPE`: **auto**: Minio bucket lookup method defaults to auto mode; set it to `dns` for virtual host style or `path` for path style, only available when STORAGE_TYPE is `minio`
- `MINIO_BUCKET_LOOKUP_TYPE`: **auto**: Minio bucket lookup method defaults to auto mode; set it to `dns` for virtual host style or `path` for path style, only available when STORAGE_TYPE is `minio`

## Log (`log`)

Expand Down Expand Up @@ -1273,7 +1273,7 @@ is `data/lfs` and the default of `MINIO_BASE_PATH` is `lfs/`.
- `MINIO_BASE_PATH`: **lfs/**: Minio base path on the bucket only available when `STORAGE_TYPE` is `minio`
- `MINIO_USE_SSL`: **false**: Minio enabled ssl only available when `STORAGE_TYPE` is `minio`
- `MINIO_INSECURE_SKIP_VERIFY`: **false**: Minio skip SSL verification available when STORAGE_TYPE is `minio`
- `MINIO_LOOKUP_TYPE`: **auto**: Minio bucket lookup method defaults to auto mode; set it to `dns` for virtual host style or `path` for path style, only available when STORAGE_TYPE is `minio`
- `MINIO_BUCKET_LOOKUP_TYPE`: **auto**: Minio bucket lookup method defaults to auto mode; set it to `dns` for virtual host style or `path` for path style, only available when STORAGE_TYPE is `minio`

## Storage (`storage`)

Expand All @@ -1288,7 +1288,7 @@ Default storage configuration for attachments, lfs, avatars, repo-avatars, repo-
- `MINIO_LOCATION`: **us-east-1**: Minio location to create bucket only available when `STORAGE_TYPE` is `minio`
- `MINIO_USE_SSL`: **false**: Minio enabled ssl only available when `STORAGE_TYPE` is `minio`
- `MINIO_INSECURE_SKIP_VERIFY`: **false**: Minio skip SSL verification available when STORAGE_TYPE is `minio`
- `MINIO_LOOKUP_TYPE`: **auto**: Minio bucket lookup method defaults to auto mode; set it to `dns` for virtual host style or `path` for path style, only available when STORAGE_TYPE is `minio`
- `MINIO_BUCKET_LOOKUP_TYPE`: **auto**: Minio bucket lookup method defaults to auto mode; set it to `dns` for virtual host style or `path` for path style, only available when STORAGE_TYPE is `minio`

The recommended storage configuration for minio like below:

Expand All @@ -1311,7 +1311,7 @@ MINIO_USE_SSL = false
MINIO_INSECURE_SKIP_VERIFY = false
SERVE_DIRECT = true
; Minio bucket lookup method defaults to auto mode; set it to `dns` for virtual host style or `path` for path style, only available when STORAGE_TYPE is `minio`
MINIO_LOOKUP_TYPE = auto
MINIO_BUCKET_LOOKUP_TYPE = auto
```

Defaultly every storage has their default base path like below
Expand Down Expand Up @@ -1358,7 +1358,7 @@ MINIO_LOCATION = us-east-1
MINIO_USE_SSL = false
; Minio skip SSL verification available when STORAGE_TYPE is `minio`
MINIO_INSECURE_SKIP_VERIFY = false; Minio bucket lookup method defaults to auto mode; set it to `dns` for virtual host style or `path` for path style, only available when STORAGE_TYPE is `minio`
MINIO_LOOKUP_TYPE = auto
MINIO_BUCKET_LOOKUP_TYPE = auto
```

## Repository Archive Storage (`storage.repo-archive`)
Expand All @@ -1378,7 +1378,7 @@ is `data/repo-archive` and the default of `MINIO_BASE_PATH` is `repo-archive/`.
- `MINIO_BASE_PATH`: **repo-archive/**: Minio base path on the bucket only available when `STORAGE_TYPE` is `minio`
- `MINIO_USE_SSL`: **false**: Minio enabled ssl only available when `STORAGE_TYPE` is `minio`
- `MINIO_INSECURE_SKIP_VERIFY`: **false**: Minio skip SSL verification available when STORAGE_TYPE is `minio`
- `MINIO_LOOKUP_TYPE`: **auto**: Minio bucket lookup method defaults to auto mode; set it to `dns` for virtual host style or `path` for path style, only available when STORAGE_TYPE is `minio`
- `MINIO_BUCKET_LOOKUP_TYPE`: **auto**: Minio bucket lookup method defaults to auto mode; set it to `dns` for virtual host style or `path` for path style, only available when STORAGE_TYPE is `minio`

## Repository Archives (`repo-archive`)

Expand Down
12 changes: 6 additions & 6 deletions docs/content/administration/config-cheat-sheet.zh-cn.md
Original file line number Diff line number Diff line change
Expand Up @@ -796,7 +796,7 @@ Gitea 创建以下非唯一队列:
- `MINIO_USE_SSL`: **false**: Minio 启用 SSL,仅当 STORAGE_TYPE 为 `minio` 时可用。
- `MINIO_INSECURE_SKIP_VERIFY`: **false**: Minio 跳过 SSL 验证,仅当 STORAGE_TYPE 为 `minio` 时可用。
- `MINIO_CHECKSUM_ALGORITHM`: **default**: Minio 校验算法:`default`(适用于 MinIO 或 AWS S3)或 `md5`(适用于 Cloudflare 或 Backblaze)
- `MINIO_LOOKUP_TYPE`: **auto**: Minio的bucket查找方式默认为`auto`模式,可将其设置为`dns`(虚拟托管样式)或`path`(路径样式),仅当`STORAGE_TYPE``minio`时可用。
- `MINIO_BUCKET_LOOKUP_TYPE`: **auto**: Minio的bucket查找方式默认为`auto`模式,可将其设置为`dns`(虚拟托管样式)或`path`(路径样式),仅当`STORAGE_TYPE``minio`时可用。

## 日志 (`log`)

Expand Down Expand Up @@ -1202,7 +1202,7 @@ ALLOW_DATA_URI_IMAGES = true
- `MINIO_BASE_PATH`**lfs/**:桶上的 Minio 基本路径,仅在 `STORAGE_TYPE``minio` 时可用。
- `MINIO_USE_SSL`**false**:Minio 启用 ssl,仅在 `STORAGE_TYPE``minio` 时可用。
- `MINIO_INSECURE_SKIP_VERIFY`**false**:Minio 跳过 SSL 验证,仅在 `STORAGE_TYPE``minio` 时可用。
- `MINIO_LOOKUP_TYPE`: **auto**: Minio的bucket查找方式默认为`auto`模式,可将其设置为`dns`(虚拟托管样式)或`path`(路径样式),仅当`STORAGE_TYPE``minio`时可用。
- `MINIO_BUCKET_LOOKUP_TYPE`: **auto**: Minio的bucket查找方式默认为`auto`模式,可将其设置为`dns`(虚拟托管样式)或`path`(路径样式),仅当`STORAGE_TYPE``minio`时可用。

## 存储 (`storage`)

Expand All @@ -1217,7 +1217,7 @@ ALLOW_DATA_URI_IMAGES = true
- `MINIO_LOCATION`**us-east-1**:创建桶的 Minio 位置,仅在 `STORAGE_TYPE``minio` 时可用。
- `MINIO_USE_SSL`**false**:Minio 启用 ssl,仅在 `STORAGE_TYPE``minio` 时可用。
- `MINIO_INSECURE_SKIP_VERIFY`**false**:Minio 跳过 SSL 验证,仅在 `STORAGE_TYPE``minio` 时可用。
- `MINIO_LOOKUP_TYPE`: **auto**: Minio的bucket查找方式默认为`auto`模式,可将其设置为`dns`(虚拟托管样式)或`path`(路径样式),仅当`STORAGE_TYPE``minio`时可用。
- `MINIO_BUCKET_LOOKUP_TYPE`: **auto**: Minio的bucket查找方式默认为`auto`模式,可将其设置为`dns`(虚拟托管样式)或`path`(路径样式),仅当`STORAGE_TYPE``minio`时可用。

建议的 minio 存储配置如下:

Expand All @@ -1240,7 +1240,7 @@ MINIO_USE_SSL = false
MINIO_INSECURE_SKIP_VERIFY = false
SERVE_DIRECT = true
; Minio bucket lookup method defaults to auto mode; set it to `dns` for virtual host style or `path` for path style, only available when STORAGE_TYPE is `minio`
MINIO_LOOKUP_TYPE = auto
MINIO_BUCKET_LOOKUP_TYPE = auto
```

默认情况下,每个存储都有其默认的基本路径,如下所示:
Expand Down Expand Up @@ -1288,7 +1288,7 @@ MINIO_USE_SSL = false
; Minio skip SSL verification available when STORAGE_TYPE is `minio`
MINIO_INSECURE_SKIP_VERIFY = false
; Minio bucket lookup method defaults to auto mode; set it to `dns` for virtual host style or `path` for path style, only available when STORAGE_TYPE is `minio`
MINIO_LOOKUP_TYPE = auto
MINIO_BUCKET_LOOKUP_TYPE = auto
```

### 存储库归档存储 (`storage.repo-archive`)
Expand All @@ -1306,7 +1306,7 @@ MINIO_LOOKUP_TYPE = auto
- `MINIO_BASE_PATH`: **repo-archive/**:存储桶上的Minio基本路径,仅在`STORAGE_TYPE``minio`时可用。
- `MINIO_USE_SSL`: **false**:启用Minio的SSL,仅在`STORAGE_TYPE``minio`时可用。
- `MINIO_INSECURE_SKIP_VERIFY`: **false**:跳过Minio的SSL验证,仅在`STORAGE_TYPE``minio`时可用。
- `MINIO_LOOKUP_TYPE`: **auto**: Minio的bucket查找方式默认为`auto`模式,可将其设置为`dns`(虚拟托管样式)或`path`(路径样式),仅当`STORAGE_TYPE``minio`时可用。
- `MINIO_BUCKET_LOOKUP_TYPE`: **auto**: Minio的bucket查找方式默认为`auto`模式,可将其设置为`dns`(虚拟托管样式)或`path`(路径样式),仅当`STORAGE_TYPE``minio`时可用。

### 存储库归档 (`repo-archive`)

Expand Down
2 changes: 1 addition & 1 deletion modules/setting/storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ type MinioStorageConfig struct {
InsecureSkipVerify bool `ini:"MINIO_INSECURE_SKIP_VERIFY"`
ChecksumAlgorithm string `ini:"MINIO_CHECKSUM_ALGORITHM" json:",omitempty"`
ServeDirect bool `ini:"SERVE_DIRECT"`
LookUpType string `ini:"MINIO_LOOKUP_TYPE"`
BucketLookUpType string `ini:"MINIO_BUCKET_LOOKUP_TYPE"`
}

// Storage represents configuration of storages
Expand Down
8 changes: 4 additions & 4 deletions modules/storage/minio.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,12 +86,12 @@ func NewMinioStorage(ctx context.Context, cfg *setting.Storage) (ObjectStorage,
log.Info("Creating Minio storage at %s:%s with base path %s", config.Endpoint, config.Bucket, config.BasePath)

lookup := minio.BucketLookupAuto
if config.LookUpType == "dns" {
if config.BucketLookUpType == "dns" {
lookup = minio.BucketLookupDNS
} else if config.LookUpType == "path" {
} else if config.BucketLookUpType == "path" {
lookup = minio.BucketLookupPath
} else if !(config.LookUpType == "auto" || config.LookUpType == "") {
return nil, fmt.Errorf("invalid minio bucket lookup type: %s", config.LookUpType)
} else if !(config.BucketLookUpType == "auto" || config.BucketLookUpType == "") {
return nil, fmt.Errorf("invalid minio bucket lookup type: %s", config.BucketLookUpType)
}

minioClient, err := minio.New(config.Endpoint, &minio.Options{
Expand Down

0 comments on commit 792a9c3

Please sign in to comment.