Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
dms3
go-dms3
Commits
fc4095cf
Commit
fc4095cf
authored
Dec 15, 2020
by
Marcin Rataj
Committed by
Adin Schmahmann
Jan 27, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactor: url → endpoint
https://github.com/ipfs/go-ipfs/pull/7828#discussion_r543520089
parent
7313a45b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
11 deletions
+9
-11
core/commands/pin/remotepin.go
core/commands/pin/remotepin.go
+9
-11
No files found.
core/commands/pin/remotepin.go
View file @
fc4095cf
...
...
@@ -444,13 +444,11 @@ TIP:
}
name
:=
req
.
Arguments
[
0
]
url
:=
req
.
Arguments
[
1
]
key
:=
req
.
Arguments
[
2
]
endpoint
,
err
:=
normalizeEndpoint
(
url
)
endpoint
,
err
:=
normalizeEndpoint
(
req
.
Arguments
[
1
])
if
err
!=
nil
{
return
err
}
key
:=
req
.
Arguments
[
2
]
cfg
,
err
:=
repo
.
Config
()
if
err
!=
nil
{
...
...
@@ -705,18 +703,14 @@ func getRemotePinService(env cmds.Environment, name string) (*pinclient.Client,
if
name
==
""
{
return
nil
,
fmt
.
Errorf
(
"remote pinning service name not specified"
)
}
url
,
key
,
err
:=
getRemotePinServiceInfo
(
env
,
name
)
if
err
!=
nil
{
return
nil
,
err
}
endpoint
,
err
:=
normalizeEndpoint
(
url
)
endpoint
,
key
,
err
:=
getRemotePinServiceInfo
(
env
,
name
)
if
err
!=
nil
{
return
nil
,
err
}
return
pinclient
.
NewClient
(
endpoint
,
key
),
nil
}
func
getRemotePinServiceInfo
(
env
cmds
.
Environment
,
name
string
)
(
url
,
key
string
,
err
error
)
{
func
getRemotePinServiceInfo
(
env
cmds
.
Environment
,
name
string
)
(
endpoint
,
key
string
,
err
error
)
{
cfgRoot
,
err
:=
cmdenv
.
GetConfigRoot
(
env
)
if
err
!=
nil
{
return
""
,
""
,
err
...
...
@@ -737,7 +731,11 @@ func getRemotePinServiceInfo(env cmds.Environment, name string) (url, key string
if
!
present
{
return
""
,
""
,
fmt
.
Errorf
(
"service not known"
)
}
return
service
.
Api
.
Endpoint
,
service
.
Api
.
Key
,
nil
endpoint
,
err
=
normalizeEndpoint
(
service
.
Api
.
Endpoint
)
if
err
!=
nil
{
return
""
,
""
,
err
}
return
endpoint
,
service
.
Api
.
Key
,
nil
}
func
normalizeEndpoint
(
endpoint
string
)
(
string
,
error
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment