MCPcopy Index your code
hub / github.com/TruthHun/BookStack / ResolveCommand

Function ResolveCommand

commands/command.go:236–277  ·  view source on GitHub ↗
(args []string)

Source from the content-addressed store, hash-verified

234}
235
236func ResolveCommand(args []string) {
237 flagSet := flag.NewFlagSet("MinDoc command: ", flag.ExitOnError)
238 flagSet.StringVar(&ConfigurationFile, "config", "", "BookStack configuration file.")
239 flagSet.StringVar(&LogFile, "log", "", "BookStack log file path.")
240
241 flagSet.Parse(args)
242
243 if ConfigurationFile == "" {
244 ConfigurationFile = filepath.Join("conf", "app.conf")
245 config := filepath.Join("conf", "app.conf.example")
246 if !utils.FileExists(ConfigurationFile) && utils.FileExists(config) {
247 utils.CopyFile(ConfigurationFile, config)
248 }
249 }
250 gocaptcha.ReadFonts(filepath.Join("static", "fonts"), ".ttf")
251
252 err := beego.LoadAppConfig("ini", ConfigurationFile)
253
254 if err != nil {
255 log.Println("An error occurred:", err)
256 os.Exit(1)
257 }
258 uploads := filepath.Join("uploads")
259
260 os.MkdirAll(uploads, 0666)
261
262 beego.BConfig.WebConfig.StaticDir["/static"] = filepath.Join("static")
263 // beego.BConfig.WebConfig.StaticDir["/uploads"] = uploads
264 beego.BConfig.WebConfig.ViewsPath = filepath.Join("views")
265
266 fonts := filepath.Join("static", "fonts")
267
268 if !utils.FileExists(fonts) {
269 log.Fatal("Font path not exist.")
270 }
271 gocaptcha.ReadFonts(filepath.Join("static", "fonts"), ".ttf")
272
273 RegisterDataBase()
274 RegisterModel()
275 RegisterLogger(LogFile)
276
277}
278
279func init() {
280

Callers 2

RunMethod · 0.92
RegisterCommandFunction · 0.85

Calls 5

FileExistsFunction · 0.92
CopyFileFunction · 0.92
RegisterDataBaseFunction · 0.85
RegisterModelFunction · 0.85
RegisterLoggerFunction · 0.85

Tested by

no test coverage detected