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

Add S3_ADDRESS_STYLE configuration option #2934

Merged
merged 2 commits into from Mar 26, 2024

Conversation

LeoQuote
Copy link
Contributor

@LeoQuote LeoQuote commented Mar 22, 2024

Description

Tencent COS does not support virtual-hosted-style bucket after 2024.1.1, see the notice

In order to use Tencent COS as external storage, addressing style must set to virtual instead of auto(default value)

https://boto3.amazonaws.com/v1/documentation/api/1.9.42/guide/s3.html#changing-the-addressing-style

This pull request add a new configuration key to support this.

Type of Change

  • New feature (non-breaking change which adds functionality)

How Has This Been Tested?

  • import config and execute get_env
>>> from config import get_env
>>> get_env('S3_ADDRESS_STYLE')
'auto'

This return the default value of s3 client, which will not change the default behavior, anyone in need can change the settings to archive their goal.

IMHO, The code change is trivial and need no further test

Suggested Checklist:

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • My changes generate no new warnings
  • I ran dev/reformat(backend) and cd web && npx lint-staged(frontend) to appease the lint gods
  • optional I have made corresponding changes to the documentation
  • optional I have added tests that prove my fix is effective or that my feature works
  • optional New and existing unit tests pass locally with my changes

@dosubot dosubot bot added the size:XS This PR changes 0-9 lines, ignoring generated files. label Mar 22, 2024
@LeoQuote
Copy link
Contributor Author

同时也给中文社群的分享一下, 如果是使用腾讯云的 COS, 除了本 PR 外, 还可以通过以下方式解决问题, 国外云厂商大多数兼容 S3, 应该不存在此问题

If using Tencent Cloud's COS, or the cloud vendor do not support path style bucket, in addition to this PR, the issue can also be resolved through the following ways.

  - name: S3_ENDPOINT
    value: "https://<bucket-name>.cos.ap-beijing.myqcloud.com"
  - name: S3_BUCKET_NAME
    value: "dify"

设置上面两个环境变量后, dify 会尝试在你的桶的 /dify 目录下创建读取文件, 不影响原有功能.

After setting the above two environment variables, Dify will attempt to create and read files in the /dify directory of your bucket without affecting existing functionality.

crazywoola
crazywoola previously approved these changes Mar 25, 2024
@dosubot dosubot bot added the 🌞 lgtm This PR has been approved by a maintainer label Mar 25, 2024
@crazywoola
Copy link
Member

Hello there is a lint error in your code.

Copy link
Collaborator

@takatost takatost left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@takatost takatost merged commit 7c8c233 into langgenius:main Mar 26, 2024
7 checks passed
@LeoQuote LeoQuote mentioned this pull request Apr 9, 2024
4 tasks
@LeoQuote LeoQuote deleted the support-address-style branch April 9, 2024 15:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🌞 lgtm This PR has been approved by a maintainer size:XS This PR changes 0-9 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants