diff options
-rw-r--r-- | hosted/credentials.html | 2 | ||||
-rw-r--r-- | src/docker.go | 2 | ||||
-rw-r--r-- | src/http.go | 6 |
3 files changed, 5 insertions, 5 deletions
diff --git a/hosted/credentials.html b/hosted/credentials.html index a49d526..88d74ea 100644 --- a/hosted/credentials.html +++ b/hosted/credentials.html @@ -47,7 +47,7 @@ </tbody> </table> - <a href="http://{{.Username}}.docker.localhost" class="btn btn-primary" role="button">Login</a> + <a href="http://{{.Username}}.${{.Hostname}}" class="btn btn-primary" role="button">Login</a> </div> </div> diff --git a/src/docker.go b/src/docker.go index 76c90e9..5cc1411 100644 --- a/src/docker.go +++ b/src/docker.go @@ -65,7 +65,7 @@ func spawnCompanion(username string, accesscode string) { Labels: map[string]string{ "traefik.enable": "true", fmt.Sprintf("traefik.http.routers.%s.entrypoints", username): "web", - fmt.Sprintf("traefik.http.routers.%s.rule", username): fmt.Sprintf("Host(`%s.docker.localhost`)", username), + fmt.Sprintf("traefik.http.routers.%s.rule", username): fmt.Sprintf("Host(`%s.%s`)", username, os.Getenv("HOSTNAME")), fmt.Sprintf("traefik.http.services.%s.loadbalancer.server.port", username): "8080", "traefik.docker.network": "circus", }, diff --git a/src/http.go b/src/http.go index 5263062..9632787 100644 --- a/src/http.go +++ b/src/http.go @@ -8,6 +8,7 @@ import ( "io/ioutil" "log" "net/http" + "os" "strings" "github.com/gorilla/mux" @@ -22,6 +23,7 @@ var ( type Credentials struct { Username string Accesscode string + Hostname string } func registerHTTPFlags() { @@ -89,9 +91,6 @@ func registerPostHandler(w http.ResponseWriter, r *http.Request) { r.Form["accesscode"] = []string{accesscodeBase64} credentialsGetHandler(w, r) - //log.Println("redirecting to /credentials") - //endpoint := fmt.Sprintf("/credentials?username=%s&accesscode=%s", usernameBase64, accesscodeBase64) - //http.Redirect(w, r, endpoint, http.StatusSeeOther) } func usernameTakenGetHandler(w http.ResponseWriter, r *http.Request) { @@ -152,6 +151,7 @@ func credentialsGetHandler(w http.ResponseWriter, r *http.Request) { creds := Credentials{ Username: string(username), Accesscode: string(accesscode), + Hostname: string(os.Getenv("HOSTNAME")), } log.Println("executing the template") t.ExecuteTemplate(w, "credentials", creds) |