good morning!!!!
Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
B
bor
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Harbor Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
open
bor
Commits
09dde380
Commit
09dde380
authored
6 years ago
by
Evgeny Danienko
Browse files
Options
Downloads
Patches
Plain Diff
cmd/swarm: use expandPath for swarm cli path parameters
parent
1f45ba9b
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
cmd/swarm/config.go
+7
-3
7 additions, 3 deletions
cmd/swarm/config.go
cmd/swarm/upload.go
+6
-0
6 additions, 0 deletions
cmd/swarm/upload.go
with
13 additions
and
3 deletions
cmd/swarm/config.go
+
7
−
3
View file @
09dde380
...
...
@@ -124,7 +124,7 @@ func initSwarmNode(config *bzzapi.Config, stack *node.Node, ctx *cli.Context) {
//get the account for the provided swarm account
prvkey
:=
getAccount
(
config
.
BzzAccount
,
ctx
,
stack
)
//set the resolved config path (geth --datadir)
config
.
Path
=
stack
.
InstanceDir
()
config
.
Path
=
expandPath
(
stack
.
InstanceDir
()
)
//finally, initialize the configuration
config
.
Init
(
prvkey
)
//configuration phase completed here
...
...
@@ -182,7 +182,7 @@ func cmdLineOverride(currentConfig *bzzapi.Config, ctx *cli.Context) *bzzapi.Con
if
ctx
.
GlobalIsSet
(
utils
.
DataDirFlag
.
Name
)
{
if
datadir
:=
ctx
.
GlobalString
(
utils
.
DataDirFlag
.
Name
);
datadir
!=
""
{
currentConfig
.
Path
=
datadir
currentConfig
.
Path
=
expandPath
(
datadir
)
}
}
...
...
@@ -226,6 +226,10 @@ func cmdLineOverride(currentConfig *bzzapi.Config, ctx *cli.Context) *bzzapi.Con
if
len
(
ensAPIs
)
==
1
&&
ensAPIs
[
0
]
==
""
{
ensAPIs
=
nil
}
for
i
:=
range
ensAPIs
{
ensAPIs
[
i
]
=
expandPath
(
ensAPIs
[
i
])
}
currentConfig
.
EnsAPIs
=
ensAPIs
}
...
...
@@ -268,7 +272,7 @@ func envVarsOverride(currentConfig *bzzapi.Config) (config *bzzapi.Config) {
}
if
datadir
:=
os
.
Getenv
(
GETH_ENV_DATADIR
);
datadir
!=
""
{
currentConfig
.
Path
=
datadir
currentConfig
.
Path
=
expandPath
(
datadir
)
}
bzzport
:=
os
.
Getenv
(
SWARM_ENV_PORT
)
...
...
This diff is collapsed.
Click to expand it.
cmd/swarm/upload.go
+
6
−
0
View file @
09dde380
...
...
@@ -138,6 +138,12 @@ func upload(ctx *cli.Context) {
// 3. cleans the path, e.g. /a/b/../c -> /a/c
// Note, it has limitations, e.g. ~someuser/tmp will not be expanded
func
expandPath
(
p
string
)
string
{
if
i
:=
strings
.
Index
(
p
,
":"
);
i
>
0
{
return
p
}
if
i
:=
strings
.
Index
(
p
,
"@"
);
i
>
0
{
return
p
}
if
strings
.
HasPrefix
(
p
,
"~/"
)
||
strings
.
HasPrefix
(
p
,
"~
\\
"
)
{
if
home
:=
homeDir
();
home
!=
""
{
p
=
home
+
p
[
1
:
]
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment