File tree Expand file tree Collapse file tree 3 files changed +15
-12
lines changed
Expand file tree Collapse file tree 3 files changed +15
-12
lines changed Original file line number Diff line number Diff line change @@ -25,9 +25,11 @@ func OpenAllCacheConnection(h *handler.Handler) error {
2525 for i := 0 ; i < e .NumField (); i ++ {
2626 cacheConfig := e .Field (i ).Interface ()
2727 if cacheConfig != nil {
28- err := OpenCacheConnection (cacheConfig .(config.Cache ), h )
29- if err != nil {
30- return err
28+ if (cacheConfig .(config.Cache ).ConnectionName != "" ) && (cacheConfig .(config.Cache ).Driver != "" ) {
29+ err := OpenCacheConnection (cacheConfig .(config.Cache ), h )
30+ if err != nil {
31+ return err
32+ }
3133 }
3234 }
3335 }
Original file line number Diff line number Diff line change @@ -31,14 +31,13 @@ func LoadAllDatabaseConnection(h *handler.Handler) error {
3131 dbs := cfg .Databases
3232 e := reflect .ValueOf (& dbs ).Elem ()
3333 for i := 0 ; i < e .NumField (); i ++ {
34- // varName := e.Type().Field(i).Name
35- // varType := e.Type().Field(i).Type
3634 dbConfig := e .Field (i ).Interface ()
37- // fmt.Printf("%v %v %v\n", varName, varType, dbConfig)
3835 if dbConfig != nil {
39- err := LoadDatabaseConnection (dbConfig .(config.Database ), h )
40- if err != nil {
41- return err
36+ if (dbConfig .(config.Database ).ConnectionName != "" ) && (dbConfig .(config.Database ).Driver != "" ) {
37+ err := LoadDatabaseConnection (dbConfig .(config.Database ), h )
38+ if err != nil {
39+ return err
40+ }
4241 }
4342 }
4443 }
Original file line number Diff line number Diff line change @@ -22,9 +22,11 @@ func OpenAllIndexerConnection(h *handler.Handler) error {
2222 for i := 0 ; i < e .NumField (); i ++ {
2323 idxConfig := e .Field (i ).Interface ()
2424 if idxConfig != nil {
25- err := OpenIndexerConnection (idxConfig .(config.Indexer ), h )
26- if err != nil {
27- return err
25+ if (idxConfig .(config.Indexer ).ConnectionName != "" ) && (idxConfig .(config.Indexer ).Driver != "" ) {
26+ err := OpenIndexerConnection (idxConfig .(config.Indexer ), h )
27+ if err != nil {
28+ return err
29+ }
2830 }
2931 }
3032 }
You can’t perform that action at this time.
0 commit comments