Repository navigation
feat(installer): provision the socket auth key in the project .env - #18
Merged
Merged
Conversation
Ports #11 (written against the 0.0.x install-fleetbase) into @fleetbase/installer: SOCKETCLUSTER_AUTH_KEY (64 hex characters, kept on re-runs when 32+), SOCKETCLUSTER_AUTH_ENABLED=false, SOCKETCLUSTER_AUTH_MODE=log and SOCKETCLUSTER_ORIGIN (the console origin) go to the root .env that Compose reads, existing values and other lines are kept, and the file is mode 600. The helper throws instead of exiting so it is unit-tested.
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.
Ports #11 into
@fleetbase/installer(packages/installer), which is whereinstall-fleetbasemoved in CLI v2. #11 was written against the 0.0.xindex.jsthat v2 removed. This port has the same behaviour as #11's final revision.The installer writes the socket settings to the project-root
.env.docker-compose.ymlreads them from there and passes them to the application, queue, scheduler and socket containers.SOCKETCLUSTER_AUTH_KEYSOCKETCLUSTER_AUTH_ENABLEDfalseSOCKETCLUSTER_AUTH_MODElogSOCKETCLUSTER_ORIGINhttp://localhost:4200on localhost,<scheme>://<host>otherwise), which falls inside the origins written toSOCKETCLUSTER_OPTIONS.env: left untouched. The last value of a key wins, as in Compose, and surrounding quotes are stripped. The file is written with mode 600.scripts/docker-install.sh. Authentication stays off untilSOCKETCLUSTER_AUTH_ENABLED=true, so clients that don't fetch socket tokens keep working..envthat is a directory throws, which the installer's top-level handler reports, instead of callingprocess.exit. That makes the helper unit-testable.ensureSocketAuthEnvis exported.Tests:
npm test -w @fleetbase/installerpasses 7 tests, 4 of them new: a fresh write, keeping existing values and lines, replacing a short key, and refusing a.envdirectory.Once this merges, #11 (into
main) can be closed.