Skip to content

Commit

Permalink
Merge pull request #541 from dedis/private_url
Browse files Browse the repository at this point in the history
sets the URL when reading private.toml
  • Loading branch information
Jeff R. Allen authored May 2, 2019
2 parents 79091d0 + 08bfdeb commit 06b1fe7
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion app/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"io"
"io/ioutil"
"os"
"strconv"
"strings"

"github.com/BurntSushi/toml"
Expand Down Expand Up @@ -102,7 +103,19 @@ func (hc *CothorityConfig) GetServerIdentity() (*network.ServerIdentity, error)
si.SetPrivate(private)
si.Description = hc.Description
si.ServiceIdentities = parseServiceConfig(hc.Services)
si.URL = hc.URL
if hc.WebSocketTLSCertificateKey != "" {
if hc.URL != "" {
si.URL = strings.Replace(hc.URL, "http://", "https://", 0)
} else {
p, err := strconv.Atoi(si.Address.Port())
if err != nil {
return nil, err
}
si.URL = fmt.Sprintf("https://%s:%d", si.Address.Host(), p+1)
}
} else {
si.URL = hc.URL
}

return si, nil
}
Expand Down

0 comments on commit 06b1fe7

Please sign in to comment.