-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmain_common.go
More file actions
26 lines (24 loc) · 854 Bytes
/
main_common.go
File metadata and controls
26 lines (24 loc) · 854 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
package main
import (
"github.com/GeertJohan/go.rice"
"github.com/midstar/llog"
)
func mainCommon() *WebAPI {
s := loadSettings(findConfFile())
llog.SetLevel(s.logLevel)
if s.logFile != "" {
llog.Info("Logging will continue in file %s", s.logFile)
llog.SetFile(s.logFile, 1024) // 1 MB logs
}
llog.Info("Version: %s", applicationVersion)
llog.Info("Build time: %s", applicationBuildTime)
llog.Info("Git hash: %s", applicationGitHash)
box := rice.MustFindBox("templates")
media := createMedia(box, s.mediaPath, s.cachePath,
s.enableThumbCache, s.genThumbsOnStartup,
s.genThumbsOnAdd, s.autoRotate, s.enablePreview, s.previewMaxSide,
s.genPreviewOnStartup, s.genPreviewOnAdd, s.enableCacheCleanup)
webAPI := CreateWebAPI(s.port, s.ip, "templates", media, box,
s.userName, s.password, s.tlsCertFile, s.tlsKeyFile)
return webAPI
}