func init() { d := &AclDriver{} dbc, err := NewDbDriver() if err != nil { panic(err.Error()) } d.dbc = dbc acl.Register("mysqlauth", d, func() error { log.Printf("INFO: register acl driver mysqlauth") return nil }) }
func init() { d := &Driver{} var file string mflag.StringVar(&file, []string{"-acl_htpasswd_file"}, "", "File path to htpasswd format file") acl.Register("htpasswd", d, func() error { htp, err := htpasswd.New(file, htpasswd.DefaultSystems, nil) if err != nil { return err } d.htp = htp watcher, err := fsnotify.NewWatcher() if err != nil { return err } defer watcher.Close() go func() { for { event := <-watcher.Events if event.Op&fsnotify.Write == fsnotify.Write { d.htp.Reload(nil) } } }() err = watcher.Add(file) if err != nil { return err } return nil }) }
func init() { d := &Driver{} acl.Register("interdict", d, func() error { return nil }) }