mirror of https://github.com/mindoc-org/mindoc.git
parent
9cacffc82c
commit
99643b0712
|
@ -60,9 +60,16 @@ func RegisterDataBase() {
|
|||
if strings.HasPrefix(database, "./") {
|
||||
database = filepath.Join(conf.WorkingDirectory, string(database[1:]))
|
||||
}
|
||||
if p,err := filepath.Abs(database); err == nil {
|
||||
database = p
|
||||
}
|
||||
|
||||
dbPath := filepath.Dir(database)
|
||||
os.MkdirAll(dbPath, 0777)
|
||||
|
||||
if _,err := os.Stat(dbPath); err != nil && os.IsNotExist(err) {
|
||||
os.MkdirAll(dbPath, 0777)
|
||||
}
|
||||
|
||||
|
||||
err := orm.RegisterDataBase("default", "sqlite3", database)
|
||||
|
||||
|
|
|
@ -9,6 +9,7 @@ import (
|
|||
"github.com/lifei6671/mindoc/commands"
|
||||
"github.com/lifei6671/mindoc/conf"
|
||||
"github.com/lifei6671/mindoc/controllers"
|
||||
"path/filepath"
|
||||
)
|
||||
|
||||
type Daemon struct {
|
||||
|
@ -51,7 +52,13 @@ func (d *Daemon) Run() {
|
|||
|
||||
beego.ErrorController(&controllers.ErrorController{})
|
||||
|
||||
fmt.Printf("MinDoc version => %s\nbuild time => %s\nstart directory => %s\n%s\n", conf.VERSION, conf.BUILD_TIME, os.Args[0], conf.GO_VERSION)
|
||||
f,err := filepath.Abs(os.Args[0])
|
||||
|
||||
if err != nil {
|
||||
f = os.Args[0]
|
||||
}
|
||||
|
||||
fmt.Printf("MinDoc version => %s\nbuild time => %s\nstart directory => %s\n%s\n", conf.VERSION, conf.BUILD_TIME, f, conf.GO_VERSION)
|
||||
|
||||
beego.Run()
|
||||
}
|
||||
|
|
|
@ -19,7 +19,6 @@ const CaptchaSessionName = "__captcha__"
|
|||
const RegexpEmail = "^[a-zA-Z0-9.!#$%&'*+\\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$"
|
||||
|
||||
//允许用户名中出现点号
|
||||
|
||||
const RegexpAccount = `^[a-zA-Z][a-zA-z0-9\.]{2,50}$`
|
||||
|
||||
// PageSize 默认分页条数.
|
||||
|
@ -75,7 +74,7 @@ var (
|
|||
|
||||
// app_key
|
||||
func GetAppKey() string {
|
||||
return beego.AppConfig.DefaultString("app_key", "godoc")
|
||||
return beego.AppConfig.DefaultString("app_key", "mindoc")
|
||||
}
|
||||
|
||||
func GetDatabasePrefix() string {
|
||||
|
@ -315,4 +314,16 @@ func WorkingDir(elem ...string) string {
|
|||
elems := append([]string{ WorkingDirectory },elem...)
|
||||
|
||||
return filepath.Join(elems...)
|
||||
}
|
||||
|
||||
func init() {
|
||||
if p,err := filepath.Abs("./conf/app.conf"); err == nil {
|
||||
ConfigurationFile = p
|
||||
}
|
||||
if p,err := filepath.Abs("./"); err == nil {
|
||||
WorkingDirectory = p
|
||||
}
|
||||
if p,err := filepath.Abs("./runtime/logs"); err == nil {
|
||||
LogFile = p
|
||||
}
|
||||
}
|
|
@ -8,4 +8,10 @@ body{
|
|||
}
|
||||
.editormd-preview-container{
|
||||
padding: 0 !important;
|
||||
}
|
||||
|
||||
.markdown-body pre{
|
||||
max-height: none !important;
|
||||
white-space: pre-wrap !important;
|
||||
word-wrap: break-word !important;
|
||||
}
|
Loading…
Reference in New Issue