Skip to content

Commit

Permalink
#20: update readme, add two separately ports
Browse files Browse the repository at this point in the history
  • Loading branch information
egregors committed Aug 9, 2024
1 parent c345f43 commit ade8b61
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 12 deletions.
14 changes: 8 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,11 +107,12 @@ import (
const userKey = "pkUser"

func main() {
proto := "http" // "http" | "https"
sub := "" // "" | "login."
host := "localhost" // "localhost" | "example.com"
port := ":8080" // port needs only for starting the server, WebauthnConfig.RPOrigins should not contain port
origin := fmt.Sprintf("%s://%s%s", proto, sub, host)
proto := "http" // "http" | "https"
sub := "" // "" | "login."
host := "localhost" // "localhost" | "example.com"
originPort := ":8080" // ":8080" | "" if you use revers proxy here should be the most "external" port
serverPort := ":8080" // ":8080"
origin := fmt.Sprintf("%s://%s%s%s", proto, sub, host, originPort)

storage := NewStorage()

Expand Down Expand Up @@ -161,9 +162,10 @@ func main() {

// start the server
fmt.Printf("Listening on %s\n", origin)
if err := http.ListenAndServe(port, mux); err != nil {
if err := http.ListenAndServe(serverPort, mux); err != nil {
panic(err)
}
}

```

Expand Down
13 changes: 7 additions & 6 deletions _example/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,12 @@ import (
const userKey = "pkUser"

func main() {
proto := "http" // "http" | "https"
sub := "" // "" | "login."
host := "localhost" // "localhost" | "example.com"
port := ":8080" // ":8080"
origin := fmt.Sprintf("%s://%s%s%s", proto, sub, host, port)
proto := "http" // "http" | "https"
sub := "" // "" | "login."
host := "localhost" // "localhost" | "example.com"
originPort := ":8080" // ":8080" | "" if you use revers proxy here should be the most "external" port
serverPort := ":8080" // ":8080"
origin := fmt.Sprintf("%s://%s%s%s", proto, sub, host, originPort)

storage := NewStorage()

Expand Down Expand Up @@ -68,7 +69,7 @@ func main() {

// start the server
fmt.Printf("Listening on %s\n", origin)
if err := http.ListenAndServe(port, mux); err != nil {
if err := http.ListenAndServe(serverPort, mux); err != nil {
panic(err)
}
}
Expand Down

0 comments on commit ade8b61

Please sign in to comment.