diff --git a/.env.example b/.env.example index 6d9e64099..14afce113 100644 --- a/.env.example +++ b/.env.example @@ -13,7 +13,6 @@ export GITHUB_TEST_APP_CLIENT_SECRET= export GITHUB_TEST_APP_ID= export GITHUB_TEST_APP_PEM= export INTERCOM_IDENTITY_SECRET_KEY= -export POSTMARK_API_KEY= export S3_BUCKET= export SCOUT_APP_KEY= export SCOUT_APP_NAME= @@ -21,3 +20,13 @@ export SEGMENT_WRITE_KEY= export SENTRY_DSN= export STRIPE_SECRET_KEY= export STRIPE_PLATFORM_CLIENT_ID= +export SPARKPOST_API_KEY= +export SPARKPOST_FORGOT_PASSWORD_TEMPLATE= +export SPARKPOST_MESSAGE_INITIATED_BY_PROJECT_TEMPLATE= +export SPARKPOST_ORGANIZATION_INVITE_TEMPLATE= +export SPARKPOST_PROJECT_APPROVAL_REQUEST_TEMPLATE= +export SPARKPOST_PROJECT_APPROVED_TEMPLATE= +export SPARKPOST_PROJECT_USER_ACCEPTANCE_TEMPLATE= +export SPARKPOST_PROJECT_USER_REQUEST_TEMPLATE= +export SPARKPOST_RECEIPT_TEMPLATE= +export SPARKPOST_REPLY_TO_CONVERSATION_TEMPLATE= diff --git a/config/config.exs b/config/config.exs index aa6063423..811e98085 100644 --- a/config/config.exs +++ b/config/config.exs @@ -14,8 +14,7 @@ config :code_corps, CodeCorpsWeb.Endpoint, url: [host: "localhost"], secret_key_base: "eMl0+Byu0Zv7q48thBu23ChBVFO1+sdLqoMI8yZoxEviF1K3C5uIohbDfvM9felL", render_errors: [view: CodeCorpsWeb.ErrorView, accepts: ~w(html json json-api)], - pubsub: [name: CodeCorps.PubSub, - adapter: Phoenix.PubSub.PG2] + pubsub: [name: CodeCorps.PubSub, adapter: Phoenix.PubSub.PG2] # Configures Elixir's Logger config :logger, :console, @@ -31,6 +30,17 @@ config :mime, :types, %{ "application/vnd.api+json" => ["json-api"] } +config :code_corps, + sparkpost_forgot_password_template: System.get_env("SPARKPOST_FORGOT_PASSWORD_TEMPLATE") || "forgot-password", + sparkpost_message_initiated_by_project_template: System.get_env("SPARKPOST_MESSAGE_INITIATED_BY_PROJECT_TEMPLATE") || "message-initiated-by-project", + sparkpost_organization_invite_template: System.get_env("SPARKPOST_ORGANIZATION_INVITE_TEMPLATE") || "organization-invite", + sparkpost_project_approval_request_template: System.get_env("SPARKPOST_PROJECT_APPROVAL_REQUEST_TEMPLATE") || "project-approval-request", + sparkpost_project_approved_template: System.get_env("SPARKPOST_PROJECT_APPROVED_TEMPLATE") || "project-approved", + sparkpost_project_user_acceptance_template: System.get_env("SPARKPOST_PROJECT_USER_ACCEPTANCE_TEMPLATE") || "project-user-acceptance", + sparkpost_project_user_request_template: System.get_env("SPARKPOST_PROJECT_USER_REQUEST_TEMPLATE") || "project-user-request", + sparkpost_receipt_template: System.get_env("SPARKPOST_RECEIPT_TEMPLATE") || "receipt", + sparkpost_reply_to_conversation_template: System.get_env("SPARKPOST_REPLY_TO_CONVERSATION_TEMPLATE") || "reply-to-conversation" + config :code_corps, CodeCorps.Guardian, issuer: "CodeCorps", ttl: { 30, :days }, @@ -72,6 +82,9 @@ config :code_corps, github_app_client_secret: System.get_env("GITHUB_APP_CLIENT_SECRET"), github_app_pem: pem +config :code_corps, + sparkpost: CodeCorps.Emails.ExtendedAPI + config :stripity_stripe, api_key: System.get_env("STRIPE_SECRET_KEY"), connect_client_id: System.get_env("STRIPE_PLATFORM_CLIENT_ID") @@ -81,6 +94,9 @@ config :sentry, enable_source_code_context: true, included_environments: ~w(prod staging)a +config :sparkpost, + api_key: System.get_env("SPARKPOST_API_KEY") + config :code_corps, :sentry, CodeCorps.Sentry.Async config :code_corps, :processor, CodeCorps.Processor.Async diff --git a/config/dev.exs b/config/dev.exs index f8f7b0b3f..3e3c7fcc4 100644 --- a/config/dev.exs +++ b/config/dev.exs @@ -56,19 +56,6 @@ config :code_corps, :stripe_env, :dev config :sentry, environment_name: Mix.env() || :dev -config :code_corps, CodeCorps.Mailer, adapter: Bamboo.LocalAdapter - -config :code_corps, - postmark_forgot_password_template: "123", - postmark_message_initiated_by_project_template: "123", - postmark_organization_invite_email_template: "123", - postmark_project_approval_request_template: "123", - postmark_project_approved_template: "123", - postmark_project_user_acceptance_template: "123", - postmark_project_user_request_template: "123", - postmark_receipt_template: "123", - postmark_reply_to_conversation_template: "123" - # If the dev environment has no CLOUDEX_API_KEY set, we want the app # to still run, with cloudex in test API mode if System.get_env("CLOUDEX_API_KEY") == nil do diff --git a/config/prod.exs b/config/prod.exs index 2665196cf..b0ce27202 100644 --- a/config/prod.exs +++ b/config/prod.exs @@ -55,21 +55,6 @@ config :code_corps, :stripe_env, :prod config :sentry, environment_name: Mix.env || :prod -config :code_corps, CodeCorps.Mailer, - adapter: Bamboo.PostmarkAdapter, - api_key: System.get_env("POSTMARK_API_KEY") - -config :code_corps, - postmark_forgot_password_template: "1989483", - postmark_message_initiated_by_project_template: "4324242", - postmark_organization_invite_email_template: "3441863", - postmark_project_approval_request_template: "4105824", - postmark_project_approved_template: "4105822", - postmark_project_user_acceptance_template: "1447041", - postmark_project_user_request_template: "4017262", - postmark_receipt_template: "1255222", - postmark_reply_to_conversation_template: "4324082" - # ## SSL Support # # To get SSL working, you will need to add the `https` key diff --git a/config/remote-development.exs b/config/remote-development.exs index 28ebf3cf6..378586eb8 100644 --- a/config/remote-development.exs +++ b/config/remote-development.exs @@ -39,20 +39,6 @@ config :logger, level: :info config :code_corps, :stripe, Stripe config :code_corps, :stripe_env, :remote_dev -config :code_corps, CodeCorps.Mailer, - adapter: Bamboo.LocalAdapter - -config :code_corps, - postmark_forgot_password_template: "123", - postmark_message_initiated_by_project_template: "123", - postmark_organization_invite_email_template: "123", - postmark_project_approval_request_template: "123", - postmark_project_approved_template: "123", - postmark_project_user_acceptance_template: "123", - postmark_project_user_request_template: "123", - postmark_receipt_template: "123", - postmark_reply_to_conversation_template: "123" - # ## SSL Support # # To get SSL working, you will need to add the `https` key diff --git a/config/staging.exs b/config/staging.exs index 947c43667..83e8568a9 100644 --- a/config/staging.exs +++ b/config/staging.exs @@ -54,21 +54,6 @@ config :sentry, config :code_corps, :stripe, Stripe config :code_corps, :stripe_env, :staging -config :code_corps, CodeCorps.Mailer, - adapter: Bamboo.PostmarkAdapter, - api_key: System.get_env("POSTMARK_API_KEY") - -config :code_corps, - postmark_forgot_password_template: "1989481", - postmark_message_initiated_by_project_template: "4324241", - postmark_organization_invite_email_template: "3442401", - postmark_project_approval_request_template: "4105823", - postmark_project_approved_template: "4105744", - postmark_project_user_acceptance_template: "1447022", - postmark_project_user_request_template: "4017261", - postmark_receipt_template: "1252361", - postmark_reply_to_conversation_template: "4324243" - # ## SSL Support # # To get SSL working, you will need to add the `https` key diff --git a/config/test.exs b/config/test.exs index a98a8e0c3..f3710c149 100644 --- a/config/test.exs +++ b/config/test.exs @@ -57,23 +57,12 @@ config :code_corps, config :sentry, environment_name: Mix.env || :test +config :code_corps, + sparkpost: CodeCorps.SparkPostTesting.SuccessAPI + config :code_corps, :sentry, CodeCorps.Sentry.Sync config :code_corps, :processor, CodeCorps.Processor.Sync -config :code_corps, CodeCorps.Mailer, - adapter: Bamboo.TestAdapter - -config :code_corps, - postmark_forgot_password_template: "123", - postmark_message_initiated_by_project_template: "123", - postmark_organization_invite_email_template: "123", - postmark_project_approval_request_template: "123", - postmark_project_approved_template: "123", - postmark_project_user_acceptance_template: "123", - postmark_project_user_request_template: "123", - postmark_receipt_template: "123", - postmark_reply_to_conversation_template: "123" - config :code_corps, :cloudex, CloudexTest config :cloudex, api_key: "test_key", secret: "test_secret", cloud_name: "test_cloud_name" diff --git a/emails/forgot_password.html b/emails/forgot_password.html index acbdfa613..9024d66fd 100644 --- a/emails/forgot_password.html +++ b/emails/forgot_password.html @@ -5,7 +5,8 @@