Set only server address
This commit is contained in:
3
.env
3
.env
@@ -1,7 +1,6 @@
|
|||||||
ARTICLE_ROOT=./articles/
|
ARTICLE_ROOT=./articles/
|
||||||
|
|
||||||
SERVER_URL=localhost:8080
|
SERVER_ADDRESS=localhost:8080
|
||||||
SERVER_PORT=8080
|
|
||||||
|
|
||||||
PREFIX=
|
PREFIX=
|
||||||
|
|
||||||
|
|||||||
@@ -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),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
2
main.go
2
main.go
@@ -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)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user