-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Description
Hey,
I just started plugin development and I think I'm missing out on something fundamental...
My plugin is called roaming
.
Here is my Corefile
:
. {
roaming
cancel
roaming
}
I know, this file does not make any sense, but for now it's okay.
From what I understand I should iterate over c.Next()
/c.Val()
to get all instances of my plugin, initialize and register them via dnsserver.GetConfig(c).AddPlugin...
.
This GetConfig(c)
seems to identify the config section via c.ServerBlockIndex, c.ServerBlockKeyIndex
.
So I build this basic test code
func setup(c *caddy.Controller) error {
for c.Next() {
log.Println(c.Val())
log.Println(c.ServerBlockIndex, c.ServerBlockKeyIndex)
for c.NextArg() {
}
}
return nil
}
bug I got this output:
roaming
0 0
roaming
0 0
Now my question:
Is this working as intended or is something wrong with my code?
From my understanding, all plugin configs for one plugin are processed at once and should be registered on different c.ServerBlockIndex, c.ServerBlockKeyIndex
pairs. But now I'm getting 0,0 twice...