feat: add environment variable support

This commit is contained in:
2025-02-07 18:47:10 +07:00
parent e6e9e25d8d
commit 710dc544c4
8 changed files with 69 additions and 13 deletions

View File

@ -10,6 +10,7 @@ import (
"os"
"strings"
"tunnel_pls/session"
"tunnel_pls/utils"
indexView "tunnel_pls/view/index"
)
@ -86,7 +87,7 @@ func Listen() {
}
router.HandleFunc("GET", "/", func(w http.ResponseWriter, r *http.Request) {
indexView.Main("Main Page").Render(r.Context(), w)
indexView.Main("Main Page", utils.Getenv("domain")).Render(r.Context(), w)
return
})
@ -126,7 +127,7 @@ func handleRequest(conn net.Conn) {
return
}
if r.Host == "localhost" {
if r.Host == utils.Getenv("domain") {
writer := &tcpResponseWriter{
conn: conn,
header: make(http.Header),