@@ -4,13 +4,11 @@ import (
44 "context"
55 "mjpclab.dev/ghfs/src/goVirtualHost"
66 "mjpclab.dev/ghfs/src/param"
7- "mjpclab.dev/ghfs/src/serverError"
87 "mjpclab.dev/ghfs/src/serverHandler"
98 "mjpclab.dev/ghfs/src/serverLog"
109 "mjpclab.dev/ghfs/src/setting"
1110 "mjpclab.dev/ghfs/src/tpl/defaultTheme"
1211 "mjpclab.dev/ghfs/src/tpl/theme"
13- "path/filepath"
1412 "time"
1513)
1614
@@ -48,7 +46,7 @@ func NewApp(params param.Params, setting *setting.Setting) (*App, []error) {
4846
4947 vhSvc := goVirtualHost .NewService ()
5048 logFileMan := serverLog .NewFileMan ()
51- themes := make (map [string ]theme.Theme )
49+ themePool := make (map [string ]theme.Theme )
5250
5351 for _ , p := range params {
5452 // logger
@@ -64,30 +62,17 @@ func NewApp(params param.Params, setting *setting.Setting) (*App, []error) {
6462 } else if len (p .Theme ) == 0 {
6563 themeInst = defaultTheme .DefaultTheme
6664 } 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 )
8366 }
8467 if len (errs ) > 0 {
68+ logger .LogErrors (errs ... )
8569 return nil , errs
8670 }
8771
8872 // vHost Handler
8973 vhHandler , errs := serverHandler .NewVhostHandler (p , logger , themeInst )
9074 if len (errs ) > 0 {
75+ logger .LogErrors (errs ... )
9176 return nil , errs
9277 }
9378
0 commit comments