Beispiel #1
0
func main() {
	check(url, email, rdbToken, pmToken, from, kindlegen)
	app := tinderizer.New(rdbToken, pmToken, from, kindlegen, logger)
	app.Run(1)

	job, err := J.New(email, url, "")
	if err != nil {
		log.Fatalf("failed building job: %s", err)
	}

	app.Queue(*job)
	app.Shutdown()
}
Beispiel #2
0
func init() {
	redis := env.StringDefault("REDISCLOUD_URL", env.StringDefault("REDIS_PORT", ""))
	if redis != "" {
		cache.SetupRedis(redis, env.StringDefault("REDIS_OPTIONS", "timeout=15s&maxidle=1"))
	}

	rdbToken := env.String("READABILITY_TOKEN")
	pmToken := env.String("POSTMARK_TOKEN")
	from := env.String("FROM")
	binary, _ := exec.LookPath(fmt.Sprintf("kindlegen-%s", runtime.GOOS))

	tlogger := log.New(os.Stdout, "[tinderizer] ", env.IntDefault("LOG_FLAGS", log.LstdFlags|log.Lmicroseconds))

	app = tinderizer.New(rdbToken, pmToken, from, binary, tlogger)
	app.Run(QueueSize)

	// TODO: handle SIGINT
	c := make(chan os.Signal, 1)
	signal.Notify(c, syscall.SIGINT, syscall.SIGTERM)
	go shutdown(c)
}