feat(config): add SPOOLMAN_API_URL with SPOOLMAN_UI_URL alias#94
Open
yfridelance wants to merge 2 commits into
Open
feat(config): add SPOOLMAN_API_URL with SPOOLMAN_UI_URL alias#94yfridelance wants to merge 2 commits into
yfridelance wants to merge 2 commits into
Conversation
Allow the Spoolman API and UI URLs to be configured independently for reverse-proxy and split-horizon deployments, where the container reaches Spoolman via internal DNS (e.g. http://spoolman:8000) while the browser must use a public hostname (e.g. https://spoolman.example.com). - Add optional SPOOLMAN_API_URL, falling back to SPOOLMAN_BASE_URL - Accept SPOOLMAN_UI_URL as a semantic alias for SPOOLMAN_BASE_URL - Backend API calls use SPOOLMAN_API_URL / SPOOLMAN_API_V1 - Rendered UI links (menu, spool detail) keep using SPOOLMAN_BASE_URL - Document new variables in config.env.template and README Backward compatible: deployments using only SPOOLMAN_BASE_URL continue to work unchanged.
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
Allow
SPOOLMAN_BASE_URL(used for UI links) and the URL used for backendAPI calls to differ. Adds an optional
SPOOLMAN_API_URLoverride andintroduces
SPOOLMAN_UI_URLas a more semantic alias for the existingSPOOLMAN_BASE_URL.Fully backward compatible — existing deployments with only
SPOOLMAN_BASE_URLcontinue to work unchanged.Problem
Today
SPOOLMAN_BASE_URLis used for two distinct concerns:QR sticker targets)
In a reverse-proxy or split-horizon setup these need different URLs:
http://spoolman:8000proxy, e.g.
https://spoolman.example.comCurrently users have to choose one. Picking the internal URL gives a
broken "Spoolman" link in the menu pointing to
http://spoolman:8000(unresolvable from a browser). Picking the external URL forces extra
DNS workarounds (
extra_hosts, customdns:entries) so the containeritself can resolve its own public hostname.
Solution
SPOOLMAN_BASE_URL(orSPOOLMAN_UI_URL)SPOOLMAN_API_URLSPOOLMAN_BASE_URLResolution order in
config.py:Example: split-horizon deployment
Existing single-URL deployments are unaffected:
Changes
config.py— acceptSPOOLMAN_UI_URLas alias; add optionalSPOOLMAN_API_URLwith fallback toSPOOLMAN_BASE_URL; replaceinternal references that hit the API to use
SPOOLMAN_API_URL/SPOOLMAN_API_V1.SPOOLMAN_BASE_URL(nosemantic change, just isolated from API resolution).
config.env.template— document the new optional variable andthe alias.
README.md— short note in the configuration section.Backward compatibility
SPOOLMAN_BASE_URLnorSPOOLMAN_UI_URLis set, behaviouris unchanged from today (i.e. unset → existing failure mode).
Test scenarios
SPOOLMAN_BASE_URLset → API calls and UI links use it (current behaviour)SPOOLMAN_UI_URLset → treated asSPOOLMAN_BASE_URLSPOOLMAN_BASE_URLandSPOOLMAN_API_URLset → API usesSPOOLMAN_API_URL, UI usesSPOOLMAN_BASE_URLSPOOLMAN_UI_URLandSPOOLMAN_API_URLset, noSPOOLMAN_BASE_URL→ UI uses the alias, API uses its own value