分离pkg
This commit is contained in:
@ -1,29 +0,0 @@
|
||||
package lightCore
|
||||
|
||||
import "code.zhecent.com/gopkg/light-core/pkg/myViper"
|
||||
|
||||
type Start struct {
|
||||
config *Config
|
||||
}
|
||||
|
||||
func NewByConfig(config *Config) *Start {
|
||||
return &Start{config: config}
|
||||
}
|
||||
|
||||
func NewByYAML(fileName string, path string) *Start {
|
||||
c := &Config{}
|
||||
myViper.NewSimpleViper(c, "yaml", fileName, path).Apply()
|
||||
return &Start{config: c}
|
||||
}
|
||||
|
||||
func (t *Start) Start() {
|
||||
//校验配置
|
||||
if t.config.App.JwtSecret == "" {
|
||||
panic("App JwtSecret Empty")
|
||||
}
|
||||
|
||||
if t.config.Server.RunMode == "" || t.config.Server.HttpPort == 0 {
|
||||
panic("Server Config Error")
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user