1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- package config
- import "eta/eta_mini_ht_api/common/contants"
- // ESOpts es连接属性
- type ESOpts struct {
- Url string
- Username string
- Password string
- }
- type ESConfig struct {
- BaseConfig
- opts ESOpts
- }
- func (e *ESConfig) GetUrl() string {
- return e.opts.Url
- }
- func (e *ESConfig) GetUserName() string {
- return e.opts.Username
- }
- func (e *ESConfig) GetPassword() string {
- return e.opts.Password
- }
- func (e *ESConfig) InitConfig() {
- opts := ESOpts{
- Url: e.GetString("url"),
- Username: e.GetString("username"),
- Password: e.GetString("password"),
- }
- e.opts = opts
- }
- func NewES() Config {
- return &ESConfig{
- BaseConfig: BaseConfig{prefix: contants.ES},
- opts: ESOpts{},
- }
- }
- func init() {
- Register(contants.ES, NewES)
- }
|