Set only server address

This commit is contained in:
2022-01-31 09:36:59 +01:00
parent 86c1bf6e86
commit fb61bf1903
3 changed files with 5 additions and 8 deletions

3
.env
View File

@@ -1,7 +1,6 @@
ARTICLE_ROOT=./articles/
SERVER_URL=localhost:8080
SERVER_PORT=8080
SERVER_ADDRESS=localhost:8080
PREFIX=

View File

@@ -15,8 +15,7 @@ var PageBase pageBase
var (
ArticleRoot string
ServerURL string
ServerPort string
ServerAddress string
Prefix string
@@ -29,8 +28,7 @@ func init() {
ArticleRoot = os.Getenv("ARTICLE_ROOT")
ServerURL = os.Getenv("SERVER_URL")
ServerPort = os.Getenv("SERVER_PORT")
ServerAddress = os.Getenv("SERVER_ADDRESS")
Prefix = os.Getenv("PREFIX")
@@ -38,6 +36,6 @@ func init() {
FrontendDir = os.Getenv("FRONTEND_DIR")
PageBase = pageBase{
BasePath: path.Join(ServerURL, Prefix),
BasePath: path.Join(ServerAddress, Prefix),
}
}

View File

@@ -25,7 +25,7 @@ func main() {
}
database.SetGlobDB(db)
if err := http.ListenAndServe(fmt.Sprintf("%s:%s", config.ServerURL, config.ServerPort), r); err != nil {
if err := http.ListenAndServe(fmt.Sprintf("%s:", config.ServerAddress), r); err != nil {
panic(err)
}
}