44 lines
599 B
Go
44 lines
599 B
Go
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
|
|
FrontendDir string
|
|
)
|
|
|
|
func init() {
|
|
godotenv.Load()
|
|
|
|
ArticleRoot = os.Getenv("ARTICLE_ROOT")
|
|
|
|
ServerURL = os.Getenv("SERVER_URL")
|
|
ServerPort = os.Getenv("SERVER_PORT")
|
|
|
|
Prefix = os.Getenv("PREFIX")
|
|
|
|
DatabaseFile = os.Getenv("DATABASE_FILE")
|
|
FrontendDir = os.Getenv("FRONTEND_DIR")
|
|
|
|
PageBase = pageBase{
|
|
BasePath: path.Join(ServerURL, Prefix),
|
|
}
|
|
}
|