Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

希望bee能够支持在编译期间检查是否应用了不存在的配置文件项 #108

Open
mnhkahn opened this issue Apr 21, 2015 · 2 comments

Comments

@mnhkahn
Copy link

mnhkahn commented Apr 21, 2015

引用配置文件项传入的是字符串,容易出错。目前引用错误,也很难发现。希望能够在编译时进行检查,一旦引用错误,则编译失败。

@astaxie
Copy link
Member

astaxie commented May 9, 2015

不存在的配置文件项是指什么?

@mnhkahn
Copy link
Author

mnhkahn commented May 20, 2015

是这样,我之前出过一个bug,拼接一个图片地址,是通过域名+图片名字的方式拼接。域名通过beego.AppConfig.String获得。当时配置文件有问题,没有获取到域名的值,所以图片上线后没有能够正常展示。

这种情况编译的时候没有问题。我想假如编译打包的时候能检测到调用了不存在的配置文件,这样子的问题就能在前期处理解决掉。

我的想法是通过beego/config包初始化配置文件,然后通过正则匹配到代码里面beego.AppConfig调用配置文件的值,然后匹配,如果引用了不存在的,就警告。还有一个想法,就是config包里面调用getdata的时候检查,如果在尝试引用不存在的配置项,发出警告,但是这样做的话警告有点多。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants