Commit 3935afac authored by Sietse Ringers's avatar Sietse Ringers
Browse files

fix: wrong verbosity handling in irma session subcommand

parent 165b4ea8
...@@ -61,7 +61,8 @@ irma session --server http://localhost:48680 --authmethod token --key mytoken -- ...@@ -61,7 +61,8 @@ irma session --server http://localhost:48680 --authmethod token --key mytoken --
if serverurl == "" { if serverurl == "" {
port, _ := flags.GetInt("port") port, _ := flags.GetInt("port")
privatekeysPath, _ := flags.GetString("privkeys") privatekeysPath, _ := flags.GetString("privkeys")
result, err = libraryRequest(request, irmaconfig, url, port, privatekeysPath, noqr) verbosity, _ := cmd.Flags().GetCount("verbose")
result, err = libraryRequest(request, irmaconfig, url, port, privatekeysPath, noqr, verbosity)
} else { } else {
authmethod, _ := flags.GetString("authmethod") authmethod, _ := flags.GetString("authmethod")
key, _ := flags.GetString("key") key, _ := flags.GetString("key")
...@@ -88,8 +89,9 @@ func libraryRequest( ...@@ -88,8 +89,9 @@ func libraryRequest(
port int, port int,
privatekeysPath string, privatekeysPath string,
noqr bool, noqr bool,
verbosity int,
) (*server.SessionResult, error) { ) (*server.SessionResult, error) {
if err := configureServer(url, port, privatekeysPath, irmaconfig); err != nil { if err := configureServer(url, port, privatekeysPath, irmaconfig, verbosity); err != nil {
return nil, err return nil, err
} }
startServer(port) startServer(port)
...@@ -187,7 +189,7 @@ func postRequest(serverurl string, request irma.RequestorRequest, name, authmeth ...@@ -187,7 +189,7 @@ func postRequest(serverurl string, request irma.RequestorRequest, name, authmeth
// Configuration functions // Configuration functions
func configureServer(url string, port int, privatekeysPath string, irmaconfig *irma.Configuration) error { func configureServer(url string, port int, privatekeysPath string, irmaconfig *irma.Configuration, verbosity int) error {
// Replace "port" in url with actual port // Replace "port" in url with actual port
replace := "$1:" + strconv.Itoa(port) replace := "$1:" + strconv.Itoa(port)
url = string(regexp.MustCompile("(https?://[^/]*):port").ReplaceAll([]byte(url), []byte(replace))) url = string(regexp.MustCompile("(https?://[^/]*):port").ReplaceAll([]byte(url), []byte(replace)))
...@@ -197,6 +199,7 @@ func configureServer(url string, port int, privatekeysPath string, irmaconfig *i ...@@ -197,6 +199,7 @@ func configureServer(url string, port int, privatekeysPath string, irmaconfig *i
Logger: logger, Logger: logger,
URL: url, URL: url,
DisableSchemesUpdate: true, DisableSchemesUpdate: true,
Verbose: verbosity,
} }
if privatekeysPath != "" { if privatekeysPath != "" {
config.IssuerPrivateKeysPath = privatekeysPath config.IssuerPrivateKeysPath = privatekeysPath
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment