From e965922892dc7d9098483c98c461460f25183bc8 Mon Sep 17 00:00:00 2001 From: Andre Medeiros Date: Mon, 5 Jul 2021 19:37:18 -0400 Subject: [PATCH] fix up heroku --- Procfile | 4 ++-- cmd/apollo-worker/main.go | 4 +++- secret/authkey.p8 | 6 ++++++ 3 files changed, 11 insertions(+), 3 deletions(-) create mode 100644 secret/authkey.p8 diff --git a/Procfile b/Procfile index decdd03..a6d59be 100644 --- a/Procfile +++ b/Procfile @@ -1,2 +1,2 @@ -postgres: postgres -D tmp/postgresql -pgbouncer: pgbouncer -q config/pgbouncer.ini +web: cmd/apollo-api +worker cmd/apollo-worker diff --git a/cmd/apollo-worker/main.go b/cmd/apollo-worker/main.go index 920337c..2893bbe 100644 --- a/cmd/apollo-worker/main.go +++ b/cmd/apollo-worker/main.go @@ -29,7 +29,7 @@ type application struct { var workers int = runtime.NumCPU() * 2 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{ AuthKey: authKey, KeyID: "T88A7G9LZ8", @@ -131,6 +131,8 @@ func main() { } defer db.Close() + logger.Printf("Starting with %d workers.", workers) + db.SetMaxOpenConns(workers) // This is a very conservative value -- seen as most of the work that is done in these jobs is diff --git a/secret/authkey.p8 b/secret/authkey.p8 new file mode 100644 index 0000000..6b94def --- /dev/null +++ b/secret/authkey.p8 @@ -0,0 +1,6 @@ +-----BEGIN PRIVATE KEY----- +MIGTAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBHkwdwIBAQQgiiEuhYosEeqNnX6t +BU6tqvo1s1lGPweAOYyUevjPqTOgCgYIKoZIzj0DAQehRANCAAS2h9dR3rmQ6iRt +rW8CC4ay9fLBGSRDv0Ptl6oAKbMGJbqkYcxOpR8zjSv3SE/dHaDWd/HK/3uqtb2i +TMJBpgHa +-----END PRIVATE KEY----- \ No newline at end of file