Commit Graph

85 Commits

Author SHA1 Message Date
astaxie a91e2e9950 add golint check and fix all golints 2017-04-30 22:41:23 +08:00
astaxie aa8f7bc146 fix ineffectual 2017-04-28 22:36:28 +08:00
astaxie d03285a0ee Merge pull request #2555 from Liaodd/master
Update ini.go: change the key to lowercase when set a new key for ini configer
2017-04-24 22:37:25 +08:00
astaxie b08ace7532 Merge pull request #2577 from ggicci/develop
Fix ini parsing error for multiple users on one machine.
2017-04-19 20:17:45 +08:00
Ggicci d1a2583972 Fix ini parsing error for multiple users on one machine.
If there were multiple users working on one machine, it's common that
"/tmp/beego" will be owned by one of them, and the others won't be able
to access to it. So, it's better to add an "id-like" postfix to the
temporary directory.
2017-04-19 19:50:11 +08:00
Liaodd d5c03f5b8f Update ini.go
change the key to lowercase when set a new key for ini configer
2017-04-10 11:30:23 +08:00
Sergey Lanzman 37c1ffc57a add go simple support 2017-03-17 20:22:20 +02:00
astaxie c2f7f3efa7 Merge pull request #2380 from fugr/config
config:fix handle include other.conf
2017-03-05 22:41:45 +08:00
Mariano Fevola e0250e2871 Fix typo 2017-03-03 16:24:02 +00:00
Faissal Elamraoui 126dbdae2f use BeeMap instead of a regular map 2017-01-16 10:08:53 +01:00
Faissal Elamraoui 957c0630c0 moved the env package to config/ 2017-01-14 10:15:02 +01:00
fugr 3fa7fc6e41 config:fix handle include other.conf
When include other.conf,other.conf is either absolute directory or under beego in default temporary directory(/tmp/beego).
maybe replace by current directory is better.
2017-01-11 18:55:53 +08: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
Faissal Elamraoui 39d40ba8fa This fixes #2294 2016-11-29 14:55:57 +01:00
Faissal Elamraoui 5bc3e30653 Added ToString method which converts values of any type to string 2016-11-29 14:55:56 +01:00
mengyuan 2b442e842e fix path issue in windows 2016-10-14 16:52:03 +08:00
astaxie 7760d24761 fix the typo 2016-08-17 23:52:34 +08:00
ysqi e9f967102c Fixed parese ini file with empty space line 2016-06-01 19:58:35 +08:00
ysqi 7e65338c87 Change key format
key format : ${ENV_PART||defaultValue} or  ${ENV_PART}
2016-03-29 21:47:33 +08:00
ysqi 5bd7d8c43f Merge branch 'astaxie/develop' into environmentVar 2016-03-29 20:55:29 +08:00
ysqi 1b04571c0b test the env use GOPATH not GOROOT 2016-03-14 19:22:00 +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
Simon Rawet 8b0957cf2e Fixed infinite loop in ini config adapter
If parseFile recived a directory it would go into a infinit loop
2016-03-12 00:20:19 +01: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 1222c87be3 optimization code 2016-01-28 14:49:44 +08:00
ysqi 484ca3a643 fixed test code error 2016-01-27 21:13:11 +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 e1f9491aed Merge pull request #1608 from ysqi/iniSaveErrorFix
Fixed #1607
2016-01-26 21:46:31 +08:00
astaxie f8004b69ad fix the go vet 2016-01-25 21:33:57 +08:00
astaxie 87650ce8bc make golint happy 2016-01-25 20:57:41 +08:00
ysqi cf055c9db2 Merge branch 'astaxie/develop' into iniSaveErrorFix
# Conflicts:
#	config/ini_test.go
2016-01-24 11:37:43 +08:00
ysqi 51ae45a799 Fixed #1607 2016-01-23 14:53:52 +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 90d1349665 fix typo 2016-01-17 23:48:17 +08:00
JessonChan 52083de720 typo fixed
seperator => separator
2016-01-15 14:07:37 +08:00
astaxie bdd6a6ae40 golint config 2015-09-10 14:53:19 +08:00
Viet Hung Nguyen cbb6591bdb fix typo 2015-08-26 15:57:28 +07:00
mlgd 9252301fa0 Fix save config ini file 2015-05-25 09:10:37 +08:00
shuo li 572508ddd8 Clean json config. Fix DefaultStrings 2014-12-17 17:02:46 +08:00
astaxie 14114018ea config ini support include 2014-10-24 19:03:27 +08:00
chenghua 180c6aafac Update ini.go
支持BOM格式的ini文件
2014-10-24 13:45:00 +08:00
xianyu ccb61f0416 gofmt
Signed-off-by: devYu <devysq@gmail.com>
2014-08-25 21:31:53 +08:00
老虞 14629c214b 优化GetData
1. 去掉重复的ToLower
2. getData内部统一ToLower
3.调整getData中对空字符串判断位置
====
4. 待确定:在getData中是否有必要进行lock操作
2014-08-25 20:14:14 +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 38188098c5 fix testing fail 2014-07-17 16:48:10 +08:00