[#390] cli: Fix bearer token reading for tree subcommands
All checks were successful
Build / Build Components (1.20) (pull_request) Successful in 3m18s
Build / Build Components (1.19) (pull_request) Successful in 4m5s
Tests and linters / Tests (1.19) (pull_request) Successful in 5m22s
ci/woodpecker/pr/pre-commit Pipeline was successful
Tests and linters / Tests (1.20) (pull_request) Successful in 5m47s
Tests and linters / Lint (pull_request) Successful in 25m1s
Tests and linters / Tests with -race (pull_request) Successful in 22m35s
All checks were successful
Build / Build Components (1.20) (pull_request) Successful in 3m18s
Build / Build Components (1.19) (pull_request) Successful in 4m5s
Tests and linters / Tests (1.19) (pull_request) Successful in 5m22s
ci/woodpecker/pr/pre-commit Pipeline was successful
Tests and linters / Tests (1.20) (pull_request) Successful in 5m47s
Tests and linters / Lint (pull_request) Successful in 25m1s
Tests and linters / Tests with -race (pull_request) Successful in 22m35s
Signed-off-by: Airat Arifullin a.arifullin@yadro.com
This commit is contained in:
parent
48b01d3ea9
commit
d92569f2df
2 changed files with 12 additions and 2 deletions
|
@ -55,13 +55,18 @@ func add(cmd *cobra.Command, _ []string) {
|
||||||
rawCID := make([]byte, sha256.Size)
|
rawCID := make([]byte, sha256.Size)
|
||||||
cnr.Encode(rawCID)
|
cnr.Encode(rawCID)
|
||||||
|
|
||||||
|
var bt []byte
|
||||||
|
if t := common.ReadBearerToken(cmd, bearerFlagKey); t != nil {
|
||||||
|
bt = t.Marshal()
|
||||||
|
}
|
||||||
|
|
||||||
req := new(tree.AddRequest)
|
req := new(tree.AddRequest)
|
||||||
req.Body = &tree.AddRequest_Body{
|
req.Body = &tree.AddRequest_Body{
|
||||||
ContainerId: rawCID,
|
ContainerId: rawCID,
|
||||||
TreeId: tid,
|
TreeId: tid,
|
||||||
ParentId: pid,
|
ParentId: pid,
|
||||||
Meta: meta,
|
Meta: meta,
|
||||||
BearerToken: common.ReadBearerToken(cmd, bearerFlagKey).Marshal(),
|
BearerToken: bt,
|
||||||
}
|
}
|
||||||
|
|
||||||
commonCmd.ExitOnErr(cmd, "signing message: %w", tree.SignMessage(req, pk))
|
commonCmd.ExitOnErr(cmd, "signing message: %w", tree.SignMessage(req, pk))
|
||||||
|
|
|
@ -63,6 +63,11 @@ func addByPath(cmd *cobra.Command, _ []string) {
|
||||||
|
|
||||||
path, _ := cmd.Flags().GetString(pathFlagKey)
|
path, _ := cmd.Flags().GetString(pathFlagKey)
|
||||||
|
|
||||||
|
var bt []byte
|
||||||
|
if t := common.ReadBearerToken(cmd, bearerFlagKey); t != nil {
|
||||||
|
bt = t.Marshal()
|
||||||
|
}
|
||||||
|
|
||||||
req := new(tree.AddByPathRequest)
|
req := new(tree.AddByPathRequest)
|
||||||
req.Body = &tree.AddByPathRequest_Body{
|
req.Body = &tree.AddByPathRequest_Body{
|
||||||
ContainerId: rawCID,
|
ContainerId: rawCID,
|
||||||
|
@ -71,7 +76,7 @@ func addByPath(cmd *cobra.Command, _ []string) {
|
||||||
// PathAttribute: pAttr,
|
// PathAttribute: pAttr,
|
||||||
Path: strings.Split(path, "/"),
|
Path: strings.Split(path, "/"),
|
||||||
Meta: meta,
|
Meta: meta,
|
||||||
BearerToken: common.ReadBearerToken(cmd, bearerFlagKey).Marshal(),
|
BearerToken: bt,
|
||||||
}
|
}
|
||||||
|
|
||||||
commonCmd.ExitOnErr(cmd, "signing message: %w", tree.SignMessage(req, pk))
|
commonCmd.ExitOnErr(cmd, "signing message: %w", tree.SignMessage(req, pk))
|
||||||
|
|
Loading…
Reference in a new issue