oh, it really is. Take a look at the code again, the current code adds some exception checking, and I didn't notice it before[1].
Sorry for this. [1] https://github.com/apache/incubator-apisix/pull/1217/files#diff-62edadffc237f13dc28a694080d293a8R703 On Thu, Mar 26, 2020 at 9:23 AM Ming Wen <wenm...@apache.org> wrote: > This PR already implemented with this idea, please read it again. > > Thanks, > Ming Wen, Apache APISIX & Apache SkyWalking > Twitter: _WenMing > > > YuanSheng Wang <membp...@apache.org> 于2020年3月26日周四 上午9:20写道: > > > Hi: > > > > We are looking for a simple and clear way to configure a DNS resolver. > This > > is our final goal. > > You know, we can not modify the title of the thread. > > > > I think we have found the right method, please confirm that this is the > > method we need. > > > > ```yaml > > # > > apisix: > > dns_resolver: # use 114.114.114.114, 223.5.5.5 as DNS resolver > > - 114.114.114.114 > > - 223.5.5.5 > > ``` > > > > ```yaml > > # > > apisix: > > # dns_resolver: # use /etc/resolver.conf as default DNS > resolver > > # - 114.114.114.114 > > # - 223.5.5.5 > > ``` > > > > > > On Thu, Mar 26, 2020 at 7:38 AM Ming Wen <wenm...@apache.org> wrote: > > > > > Hi, yuansheng, > > > please discuss around the title of thread. > > > > > > Thanks, > > > Ming Wen, Apache APISIX & Apache SkyWalking > > > Twitter: _WenMing > > > > > > > > > YuanSheng Wang <membp...@apache.org> 于2020年3月26日周四 上午7:07写道: > > > > > > > > use local dns when dns_resolver is empty. > > > > > > > > `dns_resolver is empty` means the dns_resolver should be an array and > > the > > > > size is zero, > > > > this is very different from having none. > > > > > > > > For the empty array case in yaml, it should be like this, I got it > from > > > > google search[1]: > > > > > > > > ```yaml > > > > # > > > > apisix: > > > > dns_resolver: [] # use local resolver > > > > ``` > > > > > > > > [1] > > > > > > > > > > > > > > https://stackoverflow.com/questions/5110313/how-do-i-create-an-empty-array-in-yaml > > > > > > > > > > > > On Wed, Mar 25, 2020 at 11:06 PM Ming Wen <wenm...@apache.org> > wrote: > > > > > > > > > this is exactly my design in this PR, use local dns when > > dns_resolver > > > is > > > > > empty. > > > > > > > > > > YuanSheng Wang <membp...@apache.org>于2020年3月25日 周三下午10:59写道: > > > > > > > > > > > How about this way? > > > > > > > > > > > > ```yaml > > > > > > # > > > > > > apisix: > > > > > > dns_resolver: # use 114.114.114.114, 223.5.5.5 as DNS > > > > resolver > > > > > > - 114.114.114.114 > > > > > > - 223.5.5.5 > > > > > > ``` > > > > > > > > > > > > ```yaml > > > > > > # > > > > > > apisix: > > > > > > # dns_resolver: # use /etc/resolver.conf as default DNS > > > > > resolver > > > > > > # - 114.114.114.114 > > > > > > # - 223.5.5.5 > > > > > > ``` > > > > > > > > > > > > It is simple and clear. > > > > > > > > > > > > > > > > > > On Wed, Mar 25, 2020 at 10:48 PM Ming Wen <wenm...@apache.org> > > > wrote: > > > > > > > > > > > > > Two switches means 4 combinations, which will bring more > > > complexity, > > > > > more > > > > > > > test cases, > > > > > > > and it will be difficult for users to understand. such as: > > > > > > > 1. What should I do if `dns_resolver` is empty and > > > `enable_local_dns` > > > > > is > > > > > > > false? > > > > > > > 2. What should I do if `dns_resolver` is not empty and > > > > > `enable_local_dns` > > > > > > > is true? > > > > > > > > > > > > > > To be honest, I don't know how to deal with the above two > > > situations. > > > > > > > > > > > > > > A design that doesn't need to be explained to the user is a > good > > > > > design. > > > > > > > > > > > > > > Thanks, > > > > > > > Ming Wen, Apache APISIX & Apache SkyWalking > > > > > > > Twitter: _WenMing > > > > > > > > > > > > > > > > > > > > > YuanSheng Wang <membp...@apache.org> 于2020年3月25日周三 下午9:42写道: > > > > > > > > > > > > > > > @Ming > > > > > > > > > > > > > > > > > > > > > > > > "When the dns_resolver in config.yaml is not set any IP, then > > it > > > > will > > > > > > > read > > > > > > > > the local resolv.conf. This is equivalent to a hidden > switch." > > > [1] > > > > > > > > > > > > > > > > I don't like this hidden switch. > > > > > > > > > > > > > > > > We should allow users to enable or disable local > > > `/etc/resolv.conf` > > > > > > > > independently. > > > > > > > > > > > > > > > > It's easier to understand. > > > > > > > > > > > > > > > > [1] > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > https://github.com/apache/incubator-apisix/pull/1217#issuecomment-598500231 > > > > > > > > > > > > > > > > > > > > > > > > On Wed, Mar 25, 2020 at 9:17 PM YuanSheng Wang < > > > > membp...@apache.org> > > > > > > > > wrote: > > > > > > > > > > > > > > > > > Hi > > > > > > > > > > > > > > > > > > Here is the github PR[1] > > > > > > > > > > > > > > > > > > what is your opinion about this? > > > > > > > > > > > > > > > > > > > > > > > > > > > [1] > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > https://github.com/apache/incubator-apisix/pull/1217#discussion_r397817423 > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > -- > > > > > > > > > *MembPhis* > > > > > > > > > My github: https://github.com/membphis > > > > > > > > > Apache APISIX: https://github.com/apache/incubator-apisix > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > -- > > > > > > > > *MembPhis* > > > > > > > > My github: https://github.com/membphis > > > > > > > > Apache APISIX: https://github.com/apache/incubator-apisix > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > -- > > > > > > *MembPhis* > > > > > > My github: https://github.com/membphis > > > > > > Apache APISIX: https://github.com/apache/incubator-apisix > > > > > > > > > > > -- > > > > > Thanks, > > > > > Ming Wen, Apache APISIX & Apache SkyWalking > > > > > Twitter: _WenMing > > > > > > > > > > > > > > > > > -- > > > > *MembPhis* > > > > My github: https://github.com/membphis > > > > Apache APISIX: https://github.com/apache/incubator-apisix > > > > > > > > > > > > > -- > > *MembPhis* > > My github: https://github.com/membphis > > Apache APISIX: https://github.com/apache/incubator-apisix > > > -- *MembPhis* My github: https://github.com/membphis Apache APISIX: https://github.com/apache/incubator-apisix