Skip to content

Commit

Permalink
完善文档
Browse files Browse the repository at this point in the history
  • Loading branch information
calchen committed Aug 26, 2019
1 parent f51c9a2 commit 96aa88f
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 8 deletions.
10 changes: 6 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<h1 align="center"> 用于阿里云对象存储(OSS)的 Flysystem Adapter </h1>
<h1 align="center"> flysystem-aliyun-oss </h1>

<p align="center"> 用于阿里云对象存储(OSS)的 Flysystem 适配器 </p>

<p align="center">
<a href="https://packagist.org/packages/calchen/flysystem-aliyun-oss">
Expand All @@ -16,7 +18,7 @@
这是一个基于阿里云 OSS SDK(2.3.0 及以上)的 Flysystem Adapter

受到 [apollopy/flysystem-aliyun-oss](https://github.com/apollopy/flysystem-aliyun-oss) 的启发,感谢该项目给予的帮助
受到 [apollopy/flysystem-aliyun-oss](https://github.com/apollopy/flysystem-aliyun-oss) 的启发

## 安装

Expand Down Expand Up @@ -83,15 +85,15 @@ $app->register(Calchen\Flysystem\AliyunOss\AliyunOssServiceProvider::class);

地域节点可以是域名,也可以是以 `http://域名``https://域名`

如果地域节点是域名则默认使用 https,如果需要使用 http 请使用 `http://域名`
如果地域节点是域名则默认使用 HTTPS,如果需要使用 HTTP 请使用 `http://域名`

#### 用户域名(CNAME domain)

设置成功并正常解析至阿里云 OSS 访问域名的用户域名可作为地域节点使用,如果是解析到 CDN 节点的用户域名是不可以作为地域节点使用的!!!

#### CDN 基础路径(CDN base URL)

如果您启用了 CDN 且 CDN 回源至阿里云 OSS,那么建议您设置 cdn_base_url,设置此项后您获取到的文件 URL 将全部以 cdn_base_url 开头
如果您为阿里云 OSS 存储空间启用了 CDN(无论是不是阿里云 CDN),那么建议您设置 cdn_base_url,设置此项后您获取到的文件 URL 将全部以 cdn_base_url 开头

#### 安全提醒

Expand Down
46 changes: 42 additions & 4 deletions README_en.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<h1 align="center"> Flysystem Adapter for Aliyun OSS </h1>
<h1 align="center"> flysystem-aliyun-oss </h1>

<p align="center"> Flysystem Adapter for Aliyun OSS </p>

<p align="center">
<a href="https://packagist.org/packages/calchen/flysystem-aliyun-oss">
Expand Down Expand Up @@ -53,15 +55,51 @@ Open your `config/filesystems.php` and add these lines in `disks` section
'oss' => [
'driver' => 'oss',
'access_id' => env('ALIYUN_ACCESS_KEY_ID'),
'access_key' => env('ALIYUN_ACCESS_KEY_SECRET'),
'access_key_secret' => env('ALIYUN_ACCESS_KEY_SECRET'),
'bucket' => env('ALIYUN_OSS_BUCKET'),
'endpoint' => env('ALIYUN_OSS_ENDPOINT'),
'cdn_base_url' => env('ALIYUN_OSS_CDN_BASE_URL'),
'cdn_base_url' => env('ALIYUN_OSS_CDN_BASE_URL'), // optional
'prefix' => '', // optional
],
```

If you want to use OSS by default, set `FILESYSTEM_DRIVER=oss` in `.env`

### Details
| key | required | remarks |
|------------------- |---------- |------------------------------ |
| driver | Y | default:oss, Do not change! |
| access_id | Y | See 'Security' |
| access_key_secret | Y | See 'Security' |
| bucket | Y | - |
| endpoint | Y | See 'Endpoint' |
| cdn_base_url | N | See 'CDN base URL' |
| prefix | N | - |

#### Endpoint

official endpoint list :[Regions and endpoints](https://www.alibabacloud.com/help/doc-detail/31837.htm?spm=a2c63.p38356.b99.26.4655465afRzpga)

Endpoint can be a domain name, and can be either `http://domain_name` or `http://domain_name`

If your endpoint is the domain name, HTTPS is used by default, and `http://domain_name` is used if HTTP is required

#### Custom Domain Name

When you bind a custom domain name, and mapped the CNAME record of the domain correctly. You can use this domain as endpoint.

In particular, if this custom domain name is mapped to the CDN CNAME, it can't used as endpoint!

#### CDN base URL

If you config CDN service for your Aliyun OSS Bucket (Aliyun CDN or other CDN service). It is recommended that you should set the cdn_base_url so that all the file urls you get start with cdn_base_url.

#### Security

请使用子账户的 AccessKey ID 和 AccessKey Key Secret,请务必不要使用主账户的 AccessKey ID 和 AccessKey Key Secret

For security you should use AccessKey ID and AccessKey Key Secret of RAM users, and should never use AccessKey ID and AccessKey Key Secret of cloud account

## License

MIT
[MIT](http://opensource.org/licenses/MIT)

0 comments on commit 96aa88f

Please sign in to comment.