diff --git a/README.md b/README.md index 8ac0992..2d2dd00 100644 --- a/README.md +++ b/README.md @@ -61,8 +61,25 @@ Backend: * noop (for public trackers) * [gazelle (mysql)](https://github.com/chihaya/chihaya-gazelle) -[implement a new driver]: https://github.com/chihaya/chihaya/wiki/Implementing-a-driver +To use an external driver, make your own package and call it something like `github.com/yourusername/chihaya`. Then, import Chihaya like so: +```go +package chihaya // This is your own chihaya package. + +import ( + c "github.com/chihaya/chihaya" // Use an alternate name to avoid the conflict. + + _ "github.com/yourusername/chihaya-custom-backend" // Import any of your own drivers. +) + +func main() { + c.Boot() // Start Chihaya normally. +} +``` + +Then, when you do `go install github.com/yourusername/chihaya`, your own drivers will be included in the binary. + +[implement a new driver]: https://github.com/chihaya/chihaya/wiki/Implementing-a-driver ## Contributing diff --git a/main.go b/main.go index 720bc09..c4ef7db 100644 --- a/main.go +++ b/main.go @@ -15,7 +15,7 @@ import ( "github.com/chihaya/chihaya/config" "github.com/chihaya/chihaya/http" - // All drivers are imported here. + // See the README for how to import custom drivers. _ "github.com/chihaya/chihaya/drivers/backend/noop" _ "github.com/chihaya/chihaya/drivers/tracker/memory" )