Files
backend/config/config.go
2022-01-31 09:36:59 +01:00

42 lines
556 B
Go

package config
import (
"github.com/joho/godotenv"
"os"
"path"
)
type pageBase struct {
BasePath string
}
var PageBase pageBase
var (
ArticleRoot string
ServerAddress string
Prefix string
DatabaseFile string
FrontendDir string
)
func init() {
godotenv.Load()
ArticleRoot = os.Getenv("ARTICLE_ROOT")
ServerAddress = os.Getenv("SERVER_ADDRESS")
Prefix = os.Getenv("PREFIX")
DatabaseFile = os.Getenv("DATABASE_FILE")
FrontendDir = os.Getenv("FRONTEND_DIR")
PageBase = pageBase{
BasePath: path.Join(ServerAddress, Prefix),
}
}