@@ -4,13 +4,11 @@ import (
4
4
"context"
5
5
"mjpclab.dev/ghfs/src/goVirtualHost"
6
6
"mjpclab.dev/ghfs/src/param"
7
- "mjpclab.dev/ghfs/src/serverError"
8
7
"mjpclab.dev/ghfs/src/serverHandler"
9
8
"mjpclab.dev/ghfs/src/serverLog"
10
9
"mjpclab.dev/ghfs/src/setting"
11
10
"mjpclab.dev/ghfs/src/tpl/defaultTheme"
12
11
"mjpclab.dev/ghfs/src/tpl/theme"
13
- "path/filepath"
14
12
"time"
15
13
)
16
14
@@ -48,7 +46,7 @@ func NewApp(params param.Params, setting *setting.Setting) (*App, []error) {
48
46
49
47
vhSvc := goVirtualHost .NewService ()
50
48
logFileMan := serverLog .NewFileMan ()
51
- themes := make (map [string ]theme.Theme )
49
+ themePool := make (map [string ]theme.Theme )
52
50
53
51
for _ , p := range params {
54
52
// logger
@@ -64,30 +62,17 @@ func NewApp(params param.Params, setting *setting.Setting) (*App, []error) {
64
62
} else if len (p .Theme ) == 0 {
65
63
themeInst = defaultTheme .DefaultTheme
66
64
} else {
67
- themeKey , err := filepath .Abs (p .Theme )
68
- errs = serverError .AppendError (errs , err )
69
- if err != nil {
70
- continue
71
- }
72
-
73
- var themeExists bool
74
- themeInst , themeExists = themes [themeKey ]
75
- if ! themeExists {
76
- themeInst , err = theme .LoadMemTheme (p .Theme )
77
- errs = serverError .AppendError (errs , err )
78
- if err != nil {
79
- continue
80
- }
81
- themes [themeKey ] = themeInst
82
- }
65
+ themeInst , errs = loadTheme (p .Theme , themePool )
83
66
}
84
67
if len (errs ) > 0 {
68
+ logger .LogErrors (errs ... )
85
69
return nil , errs
86
70
}
87
71
88
72
// vHost Handler
89
73
vhHandler , errs := serverHandler .NewVhostHandler (p , logger , themeInst )
90
74
if len (errs ) > 0 {
75
+ logger .LogErrors (errs ... )
91
76
return nil , errs
92
77
}
93
78
0 commit comments