Add support for PORT env variable
This commit is contained in:
parent
5e0754d0a1
commit
3086fc8297
|
@ -6,6 +6,7 @@ A third-party, open-source ProtonMail CardDAV bridge.
|
||||||
|
|
||||||
Your credentials will be stored on disk encrypted with a 32-byte random
|
Your credentials will be stored on disk encrypted with a 32-byte random
|
||||||
password. When configuring your CardDAV client, you'll need this password.
|
password. When configuring your CardDAV client, you'll need this password.
|
||||||
|
You must setup an HTTPS reverse proxy to forward requests to `hydroxide`.
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
go get github.com/emersion/hydroxide
|
go get github.com/emersion/hydroxide
|
||||||
|
|
|
@ -207,10 +207,15 @@ func main() {
|
||||||
|
|
||||||
fmt.Println("Bridge password:", bridgePassword)
|
fmt.Println("Bridge password:", bridgePassword)
|
||||||
case "":
|
case "":
|
||||||
|
port := os.Getenv("PORT")
|
||||||
|
if port == "" {
|
||||||
|
port = "8080"
|
||||||
|
}
|
||||||
|
|
||||||
sessions := make(map[string]*session)
|
sessions := make(map[string]*session)
|
||||||
|
|
||||||
s := &http.Server{
|
s := &http.Server{
|
||||||
Addr: "127.0.0.1:8080",
|
Addr: "127.0.0.1:"+port,
|
||||||
Handler: http.HandlerFunc(func(resp http.ResponseWriter, req *http.Request) {
|
Handler: http.HandlerFunc(func(resp http.ResponseWriter, req *http.Request) {
|
||||||
resp.Header().Set("WWW-Authenticate", "Basic")
|
resp.Header().Set("WWW-Authenticate", "Basic")
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue