2021-12-12 23:19:52 +08:00
|
|
|
|
---
|
|
|
|
|
title: 11.MINIO文件管理
|
|
|
|
|
description: 使用文件系统管理上传文件
|
|
|
|
|
published: true
|
2021-12-12 23:23:09 +08:00
|
|
|
|
date: 2021-12-12T15:23:08.443Z
|
2021-12-12 23:19:52 +08:00
|
|
|
|
tags: wg-basic
|
|
|
|
|
editor: markdown
|
|
|
|
|
dateCreated: 2021-12-12T15:19:50.333Z
|
|
|
|
|
---
|
|
|
|
|
|
|
|
|
|
# yml配置
|
|
|
|
|
|
|
|
|
|
```yml
|
2021-12-12 23:22:42 +08:00
|
|
|
|
# mongo配置
|
|
|
|
|
spring:
|
|
|
|
|
data:
|
|
|
|
|
mongodb:
|
|
|
|
|
uri: mongodb://user:password@127.0.0.1:27017/dbName
|
|
|
|
|
|
2021-12-12 23:19:52 +08:00
|
|
|
|
file:
|
|
|
|
|
# 启用minIo,默认为false
|
|
|
|
|
use-min-io: true
|
|
|
|
|
# 与use-min-io配套使用
|
|
|
|
|
min-io:
|
|
|
|
|
# minio服务地址
|
|
|
|
|
endpoint: http://127.0.0.1:9900
|
|
|
|
|
# 上传文件用户名,由minio服务提供
|
2021-12-12 23:23:09 +08:00
|
|
|
|
access-key: username
|
2021-12-12 23:19:52 +08:00
|
|
|
|
# 上传文件密码
|
2021-12-12 23:23:09 +08:00
|
|
|
|
secret-key: password
|
2021-12-12 23:19:52 +08:00
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
# 说明
|
|
|
|
|
|
|
|
|
|
该功能集成与 **module-file** 模块,通过 `file.use-min-io` 配置确定是否开启
|
|
|
|
|
|
2021-12-12 23:22:42 +08:00
|
|
|
|
当多系统需要统一管理文件时,需要引入 **spring-boot-starter-data-mongodb** 模块 与 **mongo-module-file** 模块
|
2021-12-12 23:19:52 +08:00
|
|
|
|
|
|
|
|
|
```yml
|
2021-12-12 23:22:42 +08:00
|
|
|
|
<!-- mongodb start -->
|
|
|
|
|
<dependency>
|
|
|
|
|
<groupId>org.springframework.boot</groupId>
|
|
|
|
|
<artifactId>spring-boot-starter-data-mongodb</artifactId>
|
|
|
|
|
</dependency>
|
|
|
|
|
<!-- mongodb end -->
|
|
|
|
|
|
2021-12-12 23:19:52 +08:00
|
|
|
|
<dependency>
|
|
|
|
|
<groupId>ink.wgink</groupId>
|
|
|
|
|
<artifactId>mongo-module-file</artifactId>
|
|
|
|
|
<version>1.0-SNAPSHOT</version>
|
|
|
|
|
</dependency>
|
|
|
|
|
```
|
|
|
|
|
|