Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

求给个阿里云oss的样例 #26

Closed
ae86208 opened this issue Sep 5, 2021 · 7 comments
Closed

求给个阿里云oss的样例 #26

ae86208 opened this issue Sep 5, 2021 · 7 comments

Comments

@ae86208
Copy link

ae86208 commented Sep 5, 2021

用oss2 感觉一夜回到解放前,自己捣鼓了几次结果403……
阿里云oss现在只支持 Virtual Hosted-Style Requests,估计和这个有关

啥时候能用了我就去地推 :)

@bbtfr
Copy link
Collaborator

bbtfr commented Sep 6, 2021

因为没 oss2 的测试环境,所以我先猜猜这样说不定可以,参考:https://blog.csdn.net/libing_thinking/article/details/79664059

  1. 配置环境变量 OSS_ENDPOINT 或者代码里设置 megfile.s3.endpoint_url = 'http:https://oss-cn-hangzhou.aliyuncs.com'
    这里的 endpoint_url 我不太确定应该填啥
  2. 用 awscli 配置一下 aws configure set s3.addressing_style virtual

@ae86208
Copy link
Author

ae86208 commented Sep 8, 2021

很强,可以用了

@xyb
Copy link
Collaborator

xyb commented Sep 8, 2021

@bbtfr Is there any chance Megfile includes automatic detection of the cloud environment and gives a more user-friendly message to set up virtual addressing style in case of access 403 failure?

@bbtfr
Copy link
Collaborator

bbtfr commented Sep 14, 2021

可能需要验证一下我们是不是支持在 .aws/config 里配置 endpoint_url

@bbtfr
Copy link
Collaborator

bbtfr commented Sep 14, 2021

@ae86208 感觉 endpoint 通过环境变量或者代码来配置还是有点麻烦的,所以讨论了下,也准备放在配置文件里,之前的代码配置或者环境变量配置也依然生效
实现上参考 https://github.com/wbingli/awscli-plugin-endpoint

支持在 ~/.aws/config 里配置 s3.endpoint_url 来配置 endpoint
例如:

$ cat ~/.aws/config
[default]

s3 =
    addressing_style = virtual
    endpoint_url = http:https://oss-cn-hangzhou.aliyuncs.com

配置时可以直接编辑这个文件,或者 aws configure set s3.endpoint_url http:https://oss-cn-hangzhou.aliyuncs.com

注:仅对 megfile 0.0.8+ 生效,awscli 如果使用这个功能,需要加上 https://github.com/wbingli/awscli-plugin-endpoint 这个插件,配置方法参考它的 readme

PR: #46

@ae86208
Copy link
Author

ae86208 commented Sep 14, 2021

注:仅对 refile 生效

应该是megfile吧

@bbtfr
Copy link
Collaborator

bbtfr commented Sep 15, 2021

注:仅对 refile 生效

应该是megfile吧

漏嘴了

@bbtfr bbtfr closed this as completed Sep 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants