Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docker/service_conf.yaml.template
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ user_default_llm:
# secret: 'secret'
# tenant_id: 'tenant_id'
# container_name: 'container_name'
# cloud: 'public' # Azure cloud: 'public', 'china', 'government', or 'germany'
# The OSS object storage uses the MySQL configuration above by default. If you need to switch to another object storage service, please uncomment and configure the following parameters.
# opendal:
# scheme: 'mysql' # Storage type, such as s3, oss, azure, etc.
Expand Down
11 changes: 10 additions & 1 deletion rag/utils/azure_spn_conn.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,13 @@
from azure.storage.filedatalake import FileSystemClient
from common import settings

_CLOUD_AUTHORITY_MAP = {
"public": AzureAuthorityHosts.AZURE_PUBLIC_CLOUD,
"china": AzureAuthorityHosts.AZURE_CHINA,
"government": AzureAuthorityHosts.AZURE_GOVERNMENT,
"germany": AzureAuthorityHosts.AZURE_GERMANY,
}


@singleton
class RAGFlowAzureSpnBlob:
Expand All @@ -32,6 +39,7 @@ def __init__(self):
self.secret = os.getenv('SECRET', settings.AZURE["secret"])
self.tenant_id = os.getenv('TENANT_ID', settings.AZURE["tenant_id"])
self.container_name = os.getenv('CONTAINER_NAME', settings.AZURE["container_name"])
self.cloud = os.getenv('AZURE_CLOUD', settings.AZURE.get("cloud", "public")).lower()
self.__open__()

def __open__(self):
Expand All @@ -42,8 +50,9 @@ def __open__(self):
pass

try:
authority = _CLOUD_AUTHORITY_MAP.get(self.cloud, AzureAuthorityHosts.AZURE_PUBLIC_CLOUD)
credentials = ClientSecretCredential(tenant_id=self.tenant_id, client_id=self.client_id,
client_secret=self.secret, authority=AzureAuthorityHosts.AZURE_CHINA)
client_secret=self.secret, authority=authority)
self.conn = FileSystemClient(account_url=self.account_url, file_system_name=self.container_name,
credential=credentials)
except Exception:
Expand Down
Loading