fix: configure AwsCredentials with AwsClientParameters for Garage
All checks were successful
Deploy Prefect Flows / deploy (push) Successful in 48s
All checks were successful
Deploy Prefect Flows / deploy (push) Successful in 48s
- Use endpoint_url via aws_client_parameters - Set signature_version to s3v4 - Set addressing_style to path - Set region to garage
This commit is contained in:
@@ -4,6 +4,7 @@ Setup Prefect Blocks from environment variables.
|
|||||||
|
|
||||||
import os
|
import os
|
||||||
from prefect_aws import AwsCredentials
|
from prefect_aws import AwsCredentials
|
||||||
|
from prefect_aws.client_parameters import AwsClientParameters
|
||||||
from prefect.blocks.system import Secret
|
from prefect.blocks.system import Secret
|
||||||
|
|
||||||
|
|
||||||
@@ -16,10 +17,20 @@ def setup_blocks():
|
|||||||
aws_endpoint = os.environ.get("AWS_ENDPOINT_URL")
|
aws_endpoint = os.environ.get("AWS_ENDPOINT_URL")
|
||||||
|
|
||||||
if all([aws_access_key, aws_secret_key, aws_endpoint]):
|
if all([aws_access_key, aws_secret_key, aws_endpoint]):
|
||||||
|
# Configuration client pour Garage (S3-compatible)
|
||||||
|
client_params = AwsClientParameters(
|
||||||
|
endpoint_url=aws_endpoint,
|
||||||
|
config={
|
||||||
|
"signature_version": "s3v4",
|
||||||
|
"s3": {"addressing_style": "path"},
|
||||||
|
},
|
||||||
|
)
|
||||||
|
|
||||||
creds = AwsCredentials(
|
creds = AwsCredentials(
|
||||||
aws_access_key_id=aws_access_key,
|
aws_access_key_id=aws_access_key,
|
||||||
aws_secret_access_key=aws_secret_key,
|
aws_secret_access_key=aws_secret_key,
|
||||||
aws_endpoint_url=aws_endpoint,
|
region_name="garage",
|
||||||
|
aws_client_parameters=client_params,
|
||||||
)
|
)
|
||||||
creds.save("garage-credentials", overwrite=True)
|
creds.save("garage-credentials", overwrite=True)
|
||||||
print("✅ Block 'garage-credentials' created/updated")
|
print("✅ Block 'garage-credentials' created/updated")
|
||||||
|
|||||||
Reference in New Issue
Block a user