Commit Graph

29 Commits

Author SHA1 Message Date
Iskander Sharipov c998e52cc0 config/yaml: s/bytes.NewBuffer/bytes.NewReader/
When io.Reader is required out of []byte,
it's better to use bytes.NewReader than bytes.NewBuffer.

Signed-off-by: Iskander Sharipov <quasilyte@gmail.com>
2019-02-10 20:37:43 +03:00
guomao545 39fc30b8b2
Support return middle level value
fix multilevel yaml config can't correct return middle level value bug
2018-07-27 15:33:24 +08:00
Xingang Zhang 78f2fd8d14 acquire lock when access config data 2018-07-21 14:56:09 +08:00
astaxie 3d3f2ed4c5
Merge pull request #3127 from kaka89/master
Refactor yaml config for support multilevel
2018-05-03 14:07:59 +08:00
umasuo ccaa2dd9e0
Update yaml.go
delete white line.
2018-04-20 19:44:22 +08:00
umasuo ba89253e4a
Update yaml.go
add support for multilevel yaml config
2018-04-20 19:40:06 +08:00
qshuai 889408136b fix typo 2018-03-28 00:26:06 +08:00
Mariano Fevola e0250e2871 Fix typo 2017-03-03 16:24:02 +00:00
fugr 6a2ee371a5 avoid creating new file to implements Config
There is no need to create new file in ParseData(data []byte) (Configer, error).Tet's make code simply.
2017-01-09 21:04:11 +08:00
astaxie 7760d24761 fix the typo 2016-08-17 23:52:34 +08:00
ysqi 7e65338c87 Change key format
key format : ${ENV_PART||defaultValue} or  ${ENV_PART}
2016-03-29 21:47:33 +08:00
ysqi 9c7d95b071 go vet 2016-03-14 19:21:09 +08:00
ysqi b2a06c5fa0 Update config suport environment variable logic 2016-03-12 14:32:39 +08:00
ysqi 86c7f1db9e Merge branch 'astaxie/develop' into environmentVar
# Conflicts:
#	config/fake.go
#	config/xml/xml_test.go
#	config/yaml/yaml_test.go
2016-03-10 19:57:16 +08:00
ysqi 19d921d3f5 Return nil not empty []string{}
Return nil if config value does not exist or is empty
2016-03-03 20:03:23 +08:00
ysqi 8ff74e71cb Fixed #1735 Return empty []string
Need return empty []string  if config value is empty.

split `“”` ==> []string{}, Not []string{“”}
2016-03-02 22:44:20 +08:00
ysqi 36f69a04a9 remove interfaceToStr function to package config 2016-02-04 20:15:37 +08:00
ysqi cd31c816cc Config support get environment variable
get environment variable if config item  has prefix "$ENV_" .
e.g.
```ini
[demo]
password = $ENV_MyPWD
```
2016-01-27 20:46:30 +08:00
astaxie 87650ce8bc make golint happy 2016-01-25 20:57:41 +08:00
ysqi be544f963e Support Parse Bool with more diffrent values
ParseBool returns the boolean value represented by the string.
It accepts 1, 1.0, t, T, TRUE, true, True, YES, yes, Yes,Y, y, ON, on,
On,
 0, 0.0, f, F, FALSE, false, False, NO, no, No, N,n, OFF, off, Off.
Any other value returns an error.
2016-01-23 11:02:40 +08:00
astaxie bdd6a6ae40 golint config 2015-09-10 14:53:19 +08:00
astaxie a144769515 update the documents & comments 2014-08-18 16:41:43 +08:00
astaxie 2820f630c8 config: add more method
DefaultString(key string, defaultval string) string      // support
section::key type in key string when using ini and json type;
Int,Int64,Bool,Float,DIY are same.
	DefaultStrings(key string, defaultval []string) []string //get string
slice
	DefaultInt(key string, defaultval int) int
	DefaultInt64(key string, defaultval int64) int64
	DefaultBool(key string, defaultval bool) bool
	DefaultFloat(key string, defaultval float64) float64
	DIY(key string) (interface{}, error)
	GetSection(section string) (map[string]string, error)
	SaveConfigFile(filename string) error
2014-08-07 17:24:21 +08:00
fuxiaohei c372328f88 code style simplify 2014-07-17 16:22:52 +08:00
astaxie fefd8ddb5b beego: update licence& fix #669 2014-07-03 23:40:21 +08:00
astaxie 0f170a80da update the comments fix #658 2014-06-25 10:39:37 +08:00
astaxie ef815bf5fc config: fix the import issue 2014-05-17 02:26:51 +08:00
astaxie c188cbbcb4 update all files License 2014-05-17 02:26:50 +08:00
slene d58e9e6e12 beego: move dependency module to sub package 2014-04-03 23:41:48 +08:00