feat(config): add secure flag to opt into HTTPS in base_url#13
Open
terafin wants to merge 1 commit into
Open
Conversation
c79e087 to
cdb2d08
Compare
terafin
referenced
this pull request
in intarweb/SGM-Helper
Jun 30, 2026
#13 added `secure: bool` to AppConfig (config.rs), but the test-code AppConfig{} initializers across helpers/{steamdeck,mister,windows} × {backend_config,service,sources}.rs lacked it -> E0063 in test compile (CI clippy/test red; release artifact unaffected since release.yml doesn't compile tests). Adds `secure: false` to all 9 fixtures. Verified false is correct for every one: grep found ZERO `secure` references in any of these test files, so none is a secure-test (the secure=true path is exercised via the ConfigOverrides/test_sources route). cargo check --tests + cargo clippy --tests green on all 3 helpers. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Adds a `secure` opt-in (env/ini: SECURE, default false) that flips base_url to https://. Wires it through ConfigOverrides + AppConfig across the mister, steamdeck, and windows helpers (struct fields, the global_overrides initializers, and all AppConfig test fixtures).
298550b to
839c967
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Helpers currently hardcode
http://regardless of port, which makes them unusable against HTTPS backends. Users running modern home setups (Traefik / nginx / Caddy with auto-TLS) need to fall back to a parallel HTTP route on their backend just to keep the helper working.Adds an opt-in
secure: boolfield sobase_url()returnshttps://...when set. Defaults tofalse— every existing config.ini is byte-identical to before. Applied identically across mister / steamdeck / windows helpers.Why
Real-world hit: Steam Deck and SS1 currently sync to
saves-sync.siliconspirit.net:80because that's the only path the helper can speak. Adding a Windows helper (arcade PC) revealed the same — port 443 withhttp://scheme returns 404 from Traefik. Forcing a parallel HTTP route on the backend isn't tenable for setups that want TLS-only.What
AppConfiggainssecure: bool(defaultfalse).ConfigOverridesgainssecure: Option<bool>.from_sourcesreadsSECUREenv/ini via existingchoose_boolhelper.base_url():Tests
base_url_uses_https_when_secure_true— happy path:SECURE=true+PORT=443→https://host:443base_url_remains_http_when_secure_unset_for_backwards_compat— regression guard: noSECUREset → byte-identicalhttp://host:port(proves no behavior change for existing users)Both tests in every helper (6 new tests total).
Migration
For users wanting HTTPS, add to
config.ini:Scope
SECURE=trueis added.--secureCLI flag could follow in a separate PR if desired.🤖 Generated with Claude Code