Skip to content

Commit

Permalink
fix(webapp): replaced hardcoded entryupintupdateaddress
Browse files Browse the repository at this point in the history
  • Loading branch information
b5 committed Apr 11, 2018
1 parent 79c6325 commit c221d7d
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions api/webapp.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,17 +38,26 @@ func (s *Server) WebappJSHandler() http.Handler {
}

func (s *Server) resolveWebappPath(path *string) {
if s.cfg.Webapp.EntrypointUpdateAddress == "" {
log.Debug("no entrypoint update address specified for update checking")
return
}

node, err := s.qriNode.IPFSNode()
if err != nil {
log.Infof("no IPFS node present to resolve webapp address: %s", err.Error())
log.Debugf("no IPFS node present to resolve webapp address: %s", err.Error())
return
}

p, err := node.Namesys.Resolve(context.Background(), "/ipns/webapp.qri.io")
p, err := node.Namesys.Resolve(context.Background(), s.cfg.Webapp.EntrypointUpdateAddress)
if err != nil {
log.Infof("error resolving IPNS Name: %s", err.Error())
return
}
if *path != p.String() {
log.Infof("updating webapp to version: %s", p.String())
}

*path = p.String()
}

Expand Down

0 comments on commit c221d7d

Please sign in to comment.