feat: add --token/t CLI option for static auth token - #356
Open
giawa wants to merge 2 commits into
Open
Conversation
Add a new --token/-t CLI option that allows specifying a static auth token instead of generating a random UUID on each server start. This is useful for: - Persistent API clients that need to survive server restarts - Development/testing with known credentials - Integration with external tools that store the token Usage: pixel-agents --port 3100 --token my-secret-token pixel-agents -p 3100 -t my-secret-token The token must be at least 8 characters. If omitted, a random UUID is generated as before (default behavior 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.
Description
Add a new --token/-t CLI option that allows specifying a static auth token instead of generating a random UUID on each server start.
This is useful for:
Usage:
pixel-agents --port 3100 --token my-secret-token
pixel-agents -p 3100 -t my-secret-token
The token must be at least 8 characters. If omitted, a random UUID is generated as before (default behavior unchanged).
Type of change
Test plan
Tested by building the app and running with
--token my-secret-token, verified the token worked as expected. I then provided no custom token and the app generated a UUID and stored it in ~/pixel-agents/server.json just like before.Unit tests have been added to verify normal usage, too-short validation, missing value and that the server actually uses the custom auth token.