Separated address and port config
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package config
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/joho/godotenv"
|
||||
"os"
|
||||
"path"
|
||||
@@ -16,6 +17,7 @@ var (
|
||||
ArticleRoot string
|
||||
|
||||
ServerAddress string
|
||||
ServerPort string
|
||||
|
||||
Prefix string
|
||||
|
||||
@@ -29,6 +31,7 @@ func init() {
|
||||
ArticleRoot = os.Getenv("ARTICLE_ROOT")
|
||||
|
||||
ServerAddress = os.Getenv("SERVER_ADDRESS")
|
||||
ServerPort = os.Getenv("SERVER_PORT")
|
||||
|
||||
Prefix = path.Join(os.Getenv("PREFIX"))
|
||||
|
||||
@@ -36,6 +39,6 @@ func init() {
|
||||
FrontendDir = os.Getenv("FRONTEND_DIR")
|
||||
|
||||
PageBase = pageBase{
|
||||
BasePath: "http://" + path.Join(ServerAddress, Prefix) + "/",
|
||||
BasePath: "http://" + path.Join(fmt.Sprintf("%s:%s", ServerAddress, ServerPort), Prefix) + "/",
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user