config.go 401 B

12345678910111213141516171819202122232425
  1. package geoip
  2. import (
  3. "github.com/mholt/caddy"
  4. )
  5. // Config specifies configuration parsed for Caddyfile
  6. type Config struct {
  7. DatabasePath string
  8. }
  9. func parseConfig(c *caddy.Controller) (Config, error) {
  10. var config = Config{}
  11. for c.Next() {
  12. value := c.Val()
  13. switch value {
  14. case "geoip":
  15. if !c.NextArg() {
  16. continue
  17. }
  18. config.DatabasePath = c.Val()
  19. }
  20. }
  21. return config, nil
  22. }