Skip to content
Snippets Groups Projects
Commit 31b1bb76 authored by Jonah Husson's avatar Jonah Husson
Browse files

Logging fixes, check path param before trying to load

parent e400fb7b
No related branches found
No related tags found
1 merge request!10Draft: November commitments
......@@ -93,7 +93,7 @@ func TestSignAndTransmit(t *testing.T) {
Port: "11420",
}, mapImpl)
if err != nil {
t.Errorf("Failed to start dummy server")
t.Errorf("Failed to start dummy server: %+v", err)
errChan <- err
} else {
doneChan <- true
......
......@@ -90,6 +90,9 @@ var serverCmd = &cobra.Command{
}
err = server.StartServer(params, s)
if err != nil {
jww.FATAL.Fatalf("Failed to start server: %+v", err)
}
var stopCh = make(chan bool)
select {
case <-stopCh:
......
......@@ -52,6 +52,7 @@ func StartServer(params Params, s *storage.Storage) error {
}
// Attempt to load in list of node IDs exempt from duplicate wallet checking
if params.IDListPath != "" {
if p, err := pathutils.ExpandPath(params.IDListPath); err == nil {
idList, err := pathutils.ReadFile(p)
if err != nil {
......@@ -66,6 +67,7 @@ func StartServer(params Params, s *storage.Storage) error {
} else {
return errors.WithMessage(err, "Failed to expand ID list path")
}
}
// Build gin server, link to verify code
r := gin.Default()
......@@ -97,7 +99,9 @@ func StartServer(params Params, s *storage.Storage) error {
c.JSON(http.StatusAccepted, newCommitment)
})
impl.comms = r
// Run with TLS
jww.INFO.Print("Starting commitments server...")
if params.KeyPath == "" && params.CertPath == "" {
jww.WARN.Println("NO TLS CONFIGURED")
return r.Run(fmt.Sprintf("0.0.0.0:%s", params.Port))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment