fix up heroku

This commit is contained in:
Andre Medeiros 2021-07-05 19:37:18 -04:00
parent 2b5758cc5c
commit e965922892
3 changed files with 11 additions and 3 deletions

View file

@ -1,2 +1,2 @@
postgres: postgres -D tmp/postgresql web: cmd/apollo-api
pgbouncer: pgbouncer -q config/pgbouncer.ini worker cmd/apollo-worker

View file

@ -29,7 +29,7 @@ type application struct {
var workers int = runtime.NumCPU() * 2 var workers int = runtime.NumCPU() * 2
func accountWorker(id int, rc *reddit.Client, db *sql.DB, logger *log.Logger, quit chan bool) { func accountWorker(id int, rc *reddit.Client, db *sql.DB, logger *log.Logger, quit chan bool) {
authKey, err := token.AuthKeyFromFile("./tmp/authkey.p8") authKey, err := token.AuthKeyFromFile(os.Getenv("APPLE_AUTHKEY_PATH"))
token := &token.Token{ token := &token.Token{
AuthKey: authKey, AuthKey: authKey,
KeyID: "T88A7G9LZ8", KeyID: "T88A7G9LZ8",
@ -131,6 +131,8 @@ func main() {
} }
defer db.Close() defer db.Close()
logger.Printf("Starting with %d workers.", workers)
db.SetMaxOpenConns(workers) db.SetMaxOpenConns(workers)
// This is a very conservative value -- seen as most of the work that is done in these jobs is // This is a very conservative value -- seen as most of the work that is done in these jobs is

6
secret/authkey.p8 Normal file
View file

@ -0,0 +1,6 @@
-----BEGIN PRIVATE KEY-----
MIGTAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBHkwdwIBAQQgiiEuhYosEeqNnX6t
BU6tqvo1s1lGPweAOYyUevjPqTOgCgYIKoZIzj0DAQehRANCAAS2h9dR3rmQ6iRt
rW8CC4ay9fLBGSRDv0Ptl6oAKbMGJbqkYcxOpR8zjSv3SE/dHaDWd/HK/3uqtb2i
TMJBpgHa
-----END PRIVATE KEY-----