Implemented subpath support

This commit is contained in:
2022-01-31 09:35:18 +01:00
parent 01e876d1e6
commit 86c1bf6e86
4 changed files with 31 additions and 14 deletions

View File

@@ -3,18 +3,25 @@ package config
import (
"github.com/joho/godotenv"
"os"
"path"
)
type pageBase struct {
BasePath string
}
var PageBase pageBase
var (
ArticleRoot string
ServerURL string
ServerPort string
Prefix string
DatabaseFile string
ArticleTemplate string
FrontendDir string
DatabaseFile string
FrontendDir string
)
func init() {
@@ -22,11 +29,15 @@ func init() {
ArticleRoot = os.Getenv("ARTICLE_ROOT")
ServerURL = os.Getenv("SERVER_URL")
ServerPort = os.Getenv("SERVER_PORT")
Prefix = os.Getenv("PREFIX")
DatabaseFile = os.Getenv("DATABASE_FILE")
ArticleTemplate = os.Getenv("ARTICLE_TEMPLATE")
FrontendDir = os.Getenv("FRONTEND_DIR")
PageBase = pageBase{
BasePath: path.Join(ServerURL, Prefix),
}
}