diff --git a/.env.sample b/.env.sample index b6c4dd4..428062a 100644 --- a/.env.sample +++ b/.env.sample @@ -1,6 +1,15 @@ +PRESENTATION_STORAGE=local + AWS_ACCESS_KEY_ID=xxx AWS_SECRET_ACCESS_KEY=xxx AWS_REGION=eu-west-3 AWS_PRES_BUCKET=xxx -PRESENTATION_STORAGE=local -MAIL=local \ No newline at end of file + +SMTP_RELAY=xx.example.com +SMTP_USERNAME=johndoe@example.com +SMTP_PASSWORD=xxx +SMTP_PORT=465 +SMTP_TLS=if_available + +MAIL_FROM=noreply@claper.co +MAIL_FROM_NAME=Claper \ No newline at end of file diff --git a/README.md b/README.md index f9c72cc..6d6fdcd 100644 --- a/README.md +++ b/README.md @@ -103,16 +103,33 @@ You can also use Docker to easily run a Postgres instance: All configuration used by the app is store on the `.env` file. You can find an example file in `.env.sample`, but you should copy it to `.env` and fill it with your own values. -Variable | Values | Default | Description ---- | --- | --- | --- -DATABASE_URL | - | postgres://claper:claper@localhost:5432/postgres | Postgres connection string -SECRET_KEY_BASE | - | - | _(only for production)_ Generate it with `mix phx.gen.secret` -PRESENTATION_STORAGE | local, s3 | local | Define where the presentation files will be stored -MAIL | local, smtp | local | Define how the mails will be sent -AWS_ACCESS_KEY_ID | - | - | _(only if s3 is used)_ Your AWS Access Key ID -AWS_SECRET_ACCESS_KEY | - | - | _(only if s3 is used)_ Your AWS Secret Access Key -AWS_S3_BUCKET | - | - | _(only if s3 is used)_ The name of the bucket where the presentation files will be stored -AWS_S3_REGION | - | - | _(only if s3 is used)_ The region where the bucket is located +#### Local + +Variable | Values | Default | Required | Description +--- | --- | --- | --- | --- +PRESENTATION_STORAGE | local, s3 | local | - | Define where the presentation files will be stored +AWS_ACCESS_KEY_ID | - | - | _only for s3_ | Your AWS Access Key ID +AWS_SECRET_ACCESS_KEY | - | - | _only for s3_ | Your AWS Secret Access Key +AWS_S3_BUCKET | - | - | _only for s3_ | The name of the bucket where the presentation files will be stored +AWS_S3_REGION | - | - | _only for s3_ | The region where the bucket is located +MAIL_FROM | - | Claper | - | Email address used to send emails +MAIL_FROM_NAME | - | noreply@claper.co | - | Name used to send emails + +#### Production / Docker + +You can use all local variables plus the following: + +Variable | Values | Default | Required | Description +--- | --- | --- | --- | --- +DATABASE_URL | - | - | ✓ | Postgres connection string +SECRET_KEY_BASE | - | - | ✓ | Generate it with `mix phx.gen.secret` +SMTP_RELAY | - | - | ✓ | SMTP relay server +SMTP_USERNAME | - | - | ✓ | SMTP username +SMTP_PASSWORD | - | - | ✓ | SMTP password +SMTP_PORT | - | 25 | - | SMTP port +SMTP_TLS | always, never, if_available | always | - | SMTP TLS +SMTP_AUTH | always, never, if_available | always | - | SMTP Auth +SMTP_SSL | true, false | true | - | SMTP SSL ### Installation diff --git a/lib/claper_web/notifiers/user_notifier.ex b/lib/claper_web/notifiers/user_notifier.ex index b2f34b3..6208ebf 100644 --- a/lib/claper_web/notifiers/user_notifier.ex +++ b/lib/claper_web/notifiers/user_notifier.ex @@ -5,7 +5,7 @@ defmodule ClaperWeb.Notifiers.UserNotifier do def magic(email, url) do new() |> to(email) - |> from({System.get_env("MAIL_FROM_NAME", "Claper"), System.get_env("MAIL_FROM", "hello@claper.co")}) + |> from({System.get_env("MAIL_FROM_NAME", "Claper"), System.get_env("MAIL_FROM", "noreply@claper.co")}) |> subject(gettext("Connect to Claper")) |> render_body("magic.html", %{url: url}) end @@ -13,7 +13,7 @@ defmodule ClaperWeb.Notifiers.UserNotifier do def welcome(email) do new() |> to(email) - |> from({System.get_env("MAIL_FROM_NAME", "Claper"), System.get_env("MAIL_FROM", "hello@claper.co")}) + |> from({System.get_env("MAIL_FROM_NAME", "Claper"), System.get_env("MAIL_FROM", "noreply@claper.co")}) |> subject(gettext("Next steps to boost your presentations")) |> render_body("welcome.html", %{email: email}) end @@ -21,7 +21,7 @@ defmodule ClaperWeb.Notifiers.UserNotifier do def update_email(user, url) do new() |> to(user.email) - |> from({System.get_env("MAIL_FROM_NAME", "Claper"), System.get_env("MAIL_FROM", "hello@claper.co")}) + |> from({System.get_env("MAIL_FROM_NAME", "Claper"), System.get_env("MAIL_FROM", "noreply@claper.co")}) |> subject(gettext("Update email instructions")) |> render_body("change.html", %{user: user, url: url}) end