Skip to content

Commit 951cc86

Browse files
committed
frcli: only use default paths if user has not defined
Only overwrite the default TLS cert and macaroon paths if the user has not explicitly defined them.
1 parent bd3736d commit 951cc86

File tree

1 file changed

+17
-6
lines changed

1 file changed

+17
-6
lines changed

cmd/frcli/utils.go

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -159,12 +159,23 @@ func extractPathArgs(ctx *cli.Context) (string, string, error) {
159159
if faradayDir != faraday.FaradayDirBase ||
160160
networkStr != faraday.DefaultNetwork {
161161

162-
tlsCertPath = filepath.Join(
163-
faradayDir, networkStr, faraday.DefaultTLSCertFilename,
164-
)
165-
macPath = filepath.Join(
166-
faradayDir, networkStr, faraday.DefaultMacaroonFilename,
167-
)
162+
// Only overwrite the tls cert path if the user has not
163+
// explicitly defined it.
164+
if !ctx.GlobalIsSet(tlsCertFlag.Name) {
165+
tlsCertPath = filepath.Join(
166+
faradayDir, networkStr,
167+
faraday.DefaultTLSCertFilename,
168+
)
169+
}
170+
171+
// Only overwrite the macaroon path if the user has not
172+
// explicitly defined it.
173+
if !ctx.GlobalIsSet(macaroonPathFlag.Name) {
174+
macPath = filepath.Join(
175+
faradayDir, networkStr,
176+
faraday.DefaultMacaroonFilename,
177+
)
178+
}
168179
}
169180

170181
return tlsCertPath, macPath, nil

0 commit comments

Comments
 (0)