This commit is contained in:
2026-08-29 09:00:21 +07:00
parent 3fb7457f61
commit 2b2b7a378e
2 changed files with 303 additions and 57 deletions
+4 -21
View File
@@ -13,11 +13,11 @@ using AWSS3
# this file use local AWS config
""" Example
storage = GeneralUtils.GarageStorage(
storage1 = GeneralUtils.GarageStorage(
"https://s3-api.yiem.cc",
"GKb080154a2e5b19100b1b2c6e", # key ID (create at garage-ui.yiem.cc)
"a2c6b1379c2f731d3e6e5a408dd4d6cffca7511717675f55114ff94828febca1", # key ID's secret key
"sommpanion-s3"
"testbucket"
)
# Safe to run inside concurrent HTTP handlers (e.g., Oxygen.jl, HTTP.jl)
@@ -30,7 +30,7 @@ println("Bucket keys: ", key)
# test with curl
curl -v \
-H 'Host: sommpanion-s3.s3-web.yiem.cc' \
-H 'Host: testbucket.s3-web.yiem.cc' \
http://192.168.88.106:3902/users-1002.json
# test with API
@@ -64,23 +64,6 @@ AWS.check_credentials(c::SimpleCredentials) = c
AWS.region(aws::GarageConfig) = aws.region
AWS.credentials(aws::GarageConfig) = aws.credentials
""" Generate the base URL for a Garage S3 service request.
# Arguments
- `aws::GarageConfig`
The Garage configuration containing the endpoint.
- `service::String`
The AWS service name (e.g., `"s3"`).
- `region::String`
The AWS region string.
# Return
- `String`: The stripped endpoint URL (trailing slashes removed).
"""
function AWS.generate_service_url(aws::GarageConfig, service::String, region::String)
return strip(aws.endpoint, '/')
end
""" Generate the full service URL including the resource path for a Garage S3 request.
# Arguments
@@ -183,7 +166,7 @@ function (pf::put_file)(key::String, data::Union{String, Vector{UInt8}}
println("Successfully uploaded: ", key)
# object url
api = "$(storage.config.endpoint)/$(storage.bucket)/$key"
api = "$(pf.storage.config.endpoint)/$(pf.storage.bucket)/$key"
# file download URL using browser
web = replace(api, "s3-api" => "s3-web")