fix: s3 file system env vars (#1112)
<!-- .github/pull_request_template.md --> ## Description <!-- Provide a clear description of the changes in this PR --> ## DCO Affirmation I affirm that all code in every commit of this pull request conforms to the terms of the Topoteretes Developer Certificate of Origin.
This commit is contained in:
parent
b72a75776d
commit
468186789c
4 changed files with 10 additions and 3 deletions
3
.github/workflows/test_s3_file_storage.yml
vendored
3
.github/workflows/test_s3_file_storage.yml
vendored
|
|
@ -23,8 +23,11 @@ jobs:
|
|||
env:
|
||||
STORAGE_BACKEND: s3
|
||||
ENABLE_BACKEND_ACCESS_CONTROL: True
|
||||
AWS_REGION: eu-west-1
|
||||
AWS_ENDPOINT_URL: https://s3-eu-west-1.amazonaws.com
|
||||
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_S3_DEV_USER_KEY_ID }}
|
||||
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_S3_DEV_USER_SECRET_KEY }}
|
||||
STORAGE_BUCKET_NAME: github-runner-cognee-tests
|
||||
LLM_MODEL: ${{ secrets.LLM_MODEL }}
|
||||
LLM_ENDPOINT: ${{ secrets.LLM_ENDPOINT }}
|
||||
LLM_API_KEY: ${{ secrets.LLM_API_KEY }}
|
||||
|
|
|
|||
|
|
@ -26,7 +26,8 @@ class S3FileStorage(Storage):
|
|||
key=s3_config.aws_access_key_id,
|
||||
secret=s3_config.aws_secret_access_key,
|
||||
anon=False,
|
||||
endpoint_url="https://s3-eu-west-1.amazonaws.com",
|
||||
endpoint_url=s3_config.aws_endpoint_url,
|
||||
client_kwargs={"region_name": s3_config.aws_region},
|
||||
)
|
||||
else:
|
||||
raise ValueError("S3 credentials are not set in the configuration.")
|
||||
|
|
|
|||
|
|
@ -4,6 +4,8 @@ from pydantic_settings import BaseSettings, SettingsConfigDict
|
|||
|
||||
|
||||
class S3Config(BaseSettings):
|
||||
aws_region: Optional[str] = None
|
||||
aws_endpoint_url: Optional[str] = None
|
||||
aws_access_key_id: Optional[str] = None
|
||||
aws_secret_access_key: Optional[str] = None
|
||||
model_config = SettingsConfigDict(env_file=".env", extra="allow")
|
||||
|
|
|
|||
|
|
@ -13,10 +13,11 @@ logger = get_logger()
|
|||
|
||||
|
||||
async def main():
|
||||
bucket_name = os.getenv("STORAGE_BUCKET_NAME")
|
||||
test_run_id = uuid4()
|
||||
data_directory_path = f"s3://cognee-storage-dev/{test_run_id}/data"
|
||||
data_directory_path = f"s3://{bucket_name}/{test_run_id}/data"
|
||||
cognee.config.data_root_directory(data_directory_path)
|
||||
cognee_directory_path = f"s3://cognee-storage-dev/{test_run_id}/system"
|
||||
cognee_directory_path = f"s3://{bucket_name}/{test_run_id}/system"
|
||||
cognee.config.system_root_directory(cognee_directory_path)
|
||||
|
||||
await cognee.prune.prune_data()
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue