Skip to content

Commit 78d2ec4

Browse files
committed
Option to deliver the original remote url instead of proxying
1 parent b41c165 commit 78d2ec4

3 files changed

Lines changed: 13 additions & 3 deletions

File tree

goosebit.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@ poll_time: 00:01:00
3232
# Whether to track the IP of the device when it polls. Useful for debugging, but can be turned off for privacy.
3333
#track_device_ip: true
3434

35+
# When enabled, remote software URLs are delivered directly to devices instead of proxying through gooseBit.
36+
# This reduces server load but requires devices to have direct network access to the remote URLs.
37+
#remote_software_direct_url: false
38+
3539
# Device authentication settings
3640
# Token-based device authentication
3741
#device_auth:

goosebit/settings/schema.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,8 @@ class GooseBitSettings(BaseSettings):
101101

102102
track_device_ip: bool = True
103103

104+
remote_software_direct_url: bool = False
105+
104106
@field_validator("secret_key", mode="before")
105107
@classmethod
106108
def import_secret_key(cls, v: Any) -> OctKey:

goosebit/updates/__init__.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
from goosebit.db.models import Device, Hardware, Software
1313
from goosebit.device_manager import DeviceManager
1414
from goosebit.schema.updates import UpdateChunk, UpdateChunkArtifact
15+
from goosebit.settings import config
1516
from goosebit.storage import storage
1617

1718
from . import swdesc
@@ -98,9 +99,12 @@ async def generate_chunk(request: Request, device: Device) -> list[UpdateChunk]:
9899
if software is None:
99100
return []
100101

101-
# Always use the download endpoint for consistency, the endpoint
102-
# will handle both local and remote files appropriately.
103-
href = str(request.url_for("download_artifact", dev_id=device.id))
102+
# For remote images with direct URL delivery enabled, use the original remote URL.
103+
# Otherwise, use the download endpoint which serves/proxies the file.
104+
if not software.local and config.remote_software_direct_url:
105+
href = software.uri
106+
else:
107+
href = str(request.url_for("download_artifact", dev_id=device.id))
104108

105109
return [
106110
UpdateChunk(

0 commit comments

Comments
 (0)