diff --git a/cmd/gin-repod/intern.go b/cmd/gin-repod/intern.go
index 2d7c89b..7168b72 100644
--- a/cmd/gin-repod/intern.go
+++ b/cmd/gin-repod/intern.go
@@ -2,7 +2,6 @@ package main
import (
"encoding/json"
- "fmt"
"log"
"net/http"
"os"
@@ -20,7 +19,7 @@ func (s *Server) repoAccess(w http.ResponseWriter, r *http.Request) {
if err != nil || query.Path == "" || query.User == "" {
w.WriteHeader(http.StatusBadRequest)
- fmt.Fprintf(os.Stderr, "Error precessing request: %v", err)
+ s.log(DEBUG, "Error processing request: %v", err)
return
}
@@ -28,6 +27,7 @@ func (s *Server) repoAccess(w http.ResponseWriter, r *http.Request) {
if err != nil {
w.WriteHeader(http.StatusBadRequest)
+ s.log(DEBUG, "Error parsing repo id: %v", err)
return
}
@@ -37,6 +37,7 @@ func (s *Server) repoAccess(w http.ResponseWriter, r *http.Request) {
if os.IsNotExist(err) {
w.WriteHeader(http.StatusNotFound)
} else {
+ s.log(DEBUG, "Error processsing request: %v", err)
w.WriteHeader(http.StatusBadRequest)
}
@@ -55,7 +56,7 @@ func (s *Server) repoAccess(w http.ResponseWriter, r *http.Request) {
}
func (s *Server) lookupUser(w http.ResponseWriter, r *http.Request) {
- log.Printf("lookupUser: %s @ %s", r.Method, r.URL.String())
+ s.log(DEBUG, "lookupUser: %s @ %s", r.Method, r.URL.String())
query := r.URL.Query()
diff --git a/cmd/gin-repod/main.go b/cmd/gin-repod/main.go
index 76f901e..44866be 100644
--- a/cmd/gin-repod/main.go
+++ b/cmd/gin-repod/main.go
@@ -256,7 +256,7 @@ Options:
args, _ := docopt.Parse(usage, nil, true, "gin repod 0.1a", false)
fmt.Println(args)
- s := NewServer(":8888")
+ s := NewServer(":8082")
s.SetupRoutes()
s.SetupServiceSecret()
s.SetupStores()
diff --git a/cmd/gin-shell/main.go b/cmd/gin-shell/main.go
index 045be78..09fd5a6 100644
--- a/cmd/gin-shell/main.go
+++ b/cmd/gin-shell/main.go
@@ -28,7 +28,7 @@ Options:
log.SetOutput(os.Stderr)
- client := client.NewClient("http://localhost:8888")
+ client := client.NewClient("http://localhost:8082")
if token, err := makeServiceToken(); err == nil {
client.AuthToken = token
diff --git a/store/ginauth.go b/store/ginauth.go
index 0cc981d..a1df6a5 100644
--- a/store/ginauth.go
+++ b/store/ginauth.go
@@ -5,6 +5,7 @@ import (
"fmt"
"io"
"io/ioutil"
+ "os"
"net/http"
"strings"
@@ -25,6 +26,10 @@ func close(b io.ReadCloser) {
func (store *GinAuthStore) LookupUserBySSH(fingerprint string) (*User, error) {
+ fingerprint = strings.Replace(fingerprint, "/", "_", -1)
+
+ fmt.Fprintf(os.Stderr, "GAS: looking up fingerprint: %v\n", fingerprint)
+
address := fmt.Sprintf("%s/api/keys/%s", store.URL, fingerprint)
res, err := http.Get(address)
diff --git a/store/repo.go b/store/repo.go
index 4bdeeea..bf0dcad 100644
--- a/store/repo.go
+++ b/store/repo.go
@@ -21,6 +21,10 @@ func (id RepoId) String() string {
}
func RepoIdParse(str string) (RepoId, error) {
+ // FIXME: we are remove leading, trailing slashes
+ // maybe that is not a good idea
+ str = strings.Trim(str, "/ ")
+
if count := strings.Count(str, "/"); count != 1 {
return RepoId{}, fmt.Errorf("malformed id: wrong number of components: %d", count)
}
diff --git a/store/user.go b/store/user.go
index 0d25d21..98bda82 100644
--- a/store/user.go
+++ b/store/user.go
@@ -18,5 +18,5 @@ type UserStore interface {
}
func NewUserStore(base string) (UserStore, error) {
- return newLocalUserStore(base)
+ return newGinAuthStore("http://localhost:8081")
}