go-archaius icon indicating copy to clipboard operation
go-archaius copied to clipboard

configmap can not be UnmarshalConfig

Open WintonChan opened this issue 3 years ago • 2 comments

Describe the bug A clear and concise description of what the bug is. use archaius to parse configmap

        apiVersion: v1
        kind: ConfigMap
        metadata:
          name: roboartisan-robooperationmanagement-config
          labels:
            name: roboartisan-robooperationmanagement-config
        data:
            database.ip: 0.0.0.0
            database.port: 5432
            database.user_name: root

the struct database

type Database struct {
	UserName string `json:"user_name"`
	Password string `json:"password"`
	IP       string `json:"ip"`
	Port     int    `json:"port"`
	DBName   string `json:"db_name"`
	SslMode  string `json:"ssl_mode"`
	MaxIdle  int    `json:"max_idle"`
	MaxConn  int    `json:"max_conn"`
}

After archaius.UnmarshalConfig ,string type data can be parse, but int type data fail to parse
Version of go chassis v1.5.4 To Reproduce Steps to reproduce the behavior:

Logs #``

WintonChan avatar Oct 19 '21 11:10 WintonChan

@five111 是否可以看下这个场景?感谢。本该修复的不解析问题依然存在https://github.com/go-chassis/go-archaius/pull/146

tianxiaoliang avatar Dec 20 '21 03:12 tianxiaoliang

I'm not sure about the specific usage scenarios, can you provide a UT that can reproduce the problem

five111 avatar Dec 21 '21 01:12 five111