-
Notifications
You must be signed in to change notification settings - Fork 1k
fix: xtoken discrepancies #4676
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
nodebuilder/core/constructors.go
Outdated
| "github.com/celestiaorg/celestia-node/libs/utils" | ||
| ) | ||
|
|
||
| var log = logging.Logger("core") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| var log = logging.Logger("core") | |
| var log = logging.Logger("nodebuilder/core") |
| defaultGRPCMessageSize = 64 * 1024 * 1024 // 64Mb | ||
|
|
||
| xtokenFileName = "xtoken.json" | ||
| xtokenFileName = "xtoken.json" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can u just array and loop?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why? there are only two file names: xtoken.json or x-token.json
| // Support "x-token" (preferred), "xtoken", and "token" JSON keys for maximum compatibility | ||
| auth := struct { | ||
| Token string `json:"x-token"` | ||
| XToken string `json:"x-token"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this can be simplified
Just construct the auth token when you successfully read from one of the expected file names.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wdym? i am reading from the expected file names, but the token name can be either of these three (x-token | xtoken | token) hence the struct and unmarshal. can u clarify?
Fixes #4676