Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConnectNatsQueue ¶
func ConnectNatsQueue(servers []string, d db.Connection) queue.Connection
ConnectNatsQueue connects the application to the Gnatsd cluster.
func ConnectRiakDb ¶
func ConnectRiakDb(host string) db.Connection
ConnectRiakDb connects the application to the Riak cluster.
func ParseNatsNodes ¶
ParseNatsNodes decies whether to connect the application to Gnatsd or not.
func ParseRiakHost ¶
ParseRiakHost decides whether to connect the application to riak or not.
Types ¶
type Context ¶
type Context struct { Db db.Connection // client to talk with a database. Queue queue.Connection // client to talk with a queue. }
Context holds connections to external dependencies. It configures the application to use specific queue and storage drivers.
func NewDefaultContext ¶
func NewDefaultContext() Context
NewDefaultContext initializes the application context. It takes the Gnatsd nodes from an environment variable called CRAWLER_GNATSD_NODES, using nats://127.0.0.1:2222 by default. It takes Riak's address from an environment variable called CRAWLER_RIAK_URL, using 127.0.0.1:8087 by default.