Skip to content

Commit b78ff09

Browse files
committed
Add S3 public endpoint for display in browser
1 parent c1672c1 commit b78ff09

7 files changed

Lines changed: 10 additions & 1 deletion

File tree

.env.example

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ S3_SECRET_KEY=your-secret-key-here
1414
# S3 domain for Caddy HTTPS (used in docker-compose.cloudflare.yml)
1515
S3_DOMAIN=s3.yourdomain.com
1616

17+
# Public S3 endpoint URL for display in browser (e.g., https://s3.yourdomain.com:8443)
18+
S3_PUBLIC_ENDPOINT=https://s3.yourdomain.com:8443
19+
1720
# Cloudflare API token for DNS challenge (Zone:DNS:Edit permission)
1821
# Create at: https://dash.cloudflare.com/profile/api-tokens
1922
CLOUDFLARE_API_TOKEN=your-cloudflare-api-token

browser/app/config.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ class Settings(BaseSettings):
1313

1414
# S3 Gateway settings
1515
s3_endpoint: str = "http://s3-gateway:9000"
16+
s3_public_endpoint: str = "" # Public S3 endpoint URL for display (e.g., https://s3.example.com:8443)
1617
s3_access_key: str = ""
1718
s3_secret_key: str = ""
1819

browser/app/main.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,7 @@ async def object_detail_page(
271271
username: str = Depends(get_current_user),
272272
s3_client: S3Client = Depends(get_s3_client),
273273
version_mapper: VersionMapper = Depends(get_version_mapper),
274+
settings: Settings = Depends(get_settings),
274275
):
275276
"""Object detail page with version history."""
276277
try:
@@ -301,6 +302,7 @@ async def object_detail_page(
301302
"versions": [v.to_dict() for v in versions],
302303
"breadcrumbs": breadcrumbs,
303304
"username": username,
305+
"s3_public_endpoint": settings.s3_public_endpoint,
304306
},
305307
)
306308
except HTTPException:

browser/app/templates/object_detail.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ <h1 class="card-title">📄 {{ key.split('/')[-1] }}</h1>
2323
<div class="metadata-grid">
2424
<div class="metadata-item">
2525
<div class="metadata-label">S3 URI</div>
26-
<div class="metadata-value"><code>s3://{{ bucket }}/{{ key }}</code></div>
26+
<div class="metadata-value"><code>{% if s3_public_endpoint %}--endpoint-url={{ s3_public_endpoint }} {% endif %}s3://{{ bucket }}/{{ key }}</code></div>
2727
</div>
2828
<div class="metadata-item">
2929
<div class="metadata-label">Size</div>

docker-compose.cloudflare.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ services:
6060
container_name: rsync-s3-browser
6161
environment:
6262
- S3_ENDPOINT=http://s3-gateway:9000
63+
- S3_PUBLIC_ENDPOINT=${S3_PUBLIC_ENDPOINT:-}
6364
- S3_ACCESS_KEY=${S3_ACCESS_KEY}
6465
- S3_SECRET_KEY=${S3_SECRET_KEY}
6566
- RSYNC_HOST=${RSYNC_HOST}

docker-compose.portainer.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ services:
5252
container_name: rsync-s3-browser
5353
environment:
5454
- S3_ENDPOINT=http://s3-gateway:9000
55+
- S3_PUBLIC_ENDPOINT=${S3_PUBLIC_ENDPOINT:-}
5556
- S3_ACCESS_KEY=${S3_ACCESS_KEY}
5657
- S3_SECRET_KEY=${S3_SECRET_KEY}
5758
- RSYNC_HOST=${RSYNC_HOST}

docker-compose.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ services:
3030
container_name: rsync-s3-browser
3131
environment:
3232
- S3_ENDPOINT=http://s3-gateway:9000
33+
- S3_PUBLIC_ENDPOINT=${S3_PUBLIC_ENDPOINT:-}
3334
- S3_ACCESS_KEY=${S3_ACCESS_KEY}
3435
- S3_SECRET_KEY=${S3_SECRET_KEY}
3536
- RSYNC_HOST=${RSYNC_HOST}

0 commit comments

Comments
 (0)