1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- package config
- import "eta/eta_mini_ht_api/common/contants"
- // ESOpts es连接属性
- type HTOpts struct {
- ReportIndex string
- MediaIndex string
- Encode string
- DesCode string
- DesSalt string
- }
- type HTBizConfig struct {
- BaseConfig
- opts HTOpts
- }
- func (e *HTBizConfig) GetReportIndex() string {
- return e.opts.ReportIndex
- }
- func (e *HTBizConfig) GetMediaIndex() string {
- return e.opts.MediaIndex
- }
- func (e *HTBizConfig) GetDesSalt() string {
- return e.opts.DesSalt
- }
- func (e *HTBizConfig) NeedEncode() bool {
- if e.opts.Encode == "true" {
- return true
- }
- return false
- }
- func (e *HTBizConfig) GetDesCode() string {
- return e.opts.DesCode
- }
- func (e *HTBizConfig) InitConfig() {
- opts := HTOpts{
- ReportIndex: e.GetString("es_report_index"),
- MediaIndex: e.GetString("es_media_index"),
- Encode: e.GetString("response.encode"),
- DesCode: e.GetString("response.des_code"),
- DesSalt: e.GetString("response.des_salt"),
- }
- e.opts = opts
- }
- func NewHT() Config {
- return &HTBizConfig{
- BaseConfig: BaseConfig{prefix: contants.HT},
- opts: HTOpts{},
- }
- }
- func init() {
- Register(contants.HT, NewHT)
- }
|