github.com/wfusion/gofusion@v1.1.14/config/types.go (about)

     1  package config
     2  
     3  import (
     4  	"github.com/wfusion/gofusion/common/di"
     5  	"github.com/wfusion/gofusion/common/utils"
     6  )
     7  
     8  type Configurable interface {
     9  	Init(businessConfig any, opts ...utils.OptionExtender) (gracefully func())
    10  	LoadComponentConfig(name string, componentConfig any) (err error)
    11  	GetAllConfigs() any
    12  	Debug() (debug bool)
    13  	AppName() (name string)
    14  	DI() di.DI
    15  }
    16  
    17  type InitOption struct {
    18  	DI      di.DI
    19  	AppName string
    20  }
    21  
    22  func AppName(name string) utils.OptionFunc[InitOption] {
    23  	return func(o *InitOption) {
    24  		o.AppName = name
    25  	}
    26  }
    27  
    28  func DI(di di.DI) utils.OptionFunc[InitOption] {
    29  	return func(o *InitOption) {
    30  		o.DI = di
    31  	}
    32  }