Skip to content

Commit

Permalink
frcli: only use default paths if user has not defined
Browse files Browse the repository at this point in the history
Only overwrite the default TLS cert and macaroon paths if the user has
not explicitly defined them.
  • Loading branch information
ellemouton committed Aug 15, 2024
1 parent bd3736d commit 951cc86
Showing 1 changed file with 17 additions and 6 deletions.
23 changes: 17 additions & 6 deletions cmd/frcli/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,12 +159,23 @@ func extractPathArgs(ctx *cli.Context) (string, string, error) {
if faradayDir != faraday.FaradayDirBase ||
networkStr != faraday.DefaultNetwork {

tlsCertPath = filepath.Join(
faradayDir, networkStr, faraday.DefaultTLSCertFilename,
)
macPath = filepath.Join(
faradayDir, networkStr, faraday.DefaultMacaroonFilename,
)
// Only overwrite the tls cert path if the user has not
// explicitly defined it.
if !ctx.GlobalIsSet(tlsCertFlag.Name) {
tlsCertPath = filepath.Join(
faradayDir, networkStr,
faraday.DefaultTLSCertFilename,
)
}

// Only overwrite the macaroon path if the user has not
// explicitly defined it.
if !ctx.GlobalIsSet(macaroonPathFlag.Name) {
macPath = filepath.Join(
faradayDir, networkStr,
faraday.DefaultMacaroonFilename,
)
}
}

return tlsCertPath, macPath, nil
Expand Down

0 comments on commit 951cc86

Please sign in to comment.