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/ ARTICLE_ROOT=./articles/
SERVER_URL=localhost:8080 SERVER_ADDRESS=localhost:8080
SERVER_PORT=8080
PREFIX= PREFIX=

View File

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

View File

@@ -25,7 +25,7 @@ func main() {
} }
database.SetGlobDB(db) 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) panic(err)
} }
} }