28 lines
470 B
Go
28 lines
470 B
Go
package storage
|
|
|
|
import (
|
|
"pink_fox/inner/config"
|
|
"pink_fox/packages/fw"
|
|
)
|
|
|
|
type Storage struct {
|
|
Config *config.Config
|
|
Port int
|
|
Debug bool
|
|
Template *fw.JetTemplate
|
|
}
|
|
|
|
func New(port int, configPath string) (*Storage, fw.Error) {
|
|
conf, err := config.LoadConfig(configPath)
|
|
if err != nil {
|
|
return nil, err.Tap()
|
|
}
|
|
|
|
return &Storage{
|
|
Config: conf,
|
|
Port: port,
|
|
Debug: conf.Debug,
|
|
Template: fw.NewJetTemplate("/app/templates"),
|
|
}, nil
|
|
}
|