diff --git a/.gitignore b/.gitignore index 6da7176..87d21c7 100644 --- a/.gitignore +++ b/.gitignore @@ -35,4 +35,7 @@ npm-debug.log /priv/native/ .idea .env -.envrc \ No newline at end of file +.envrc + +# Secret config files +config/*.secret.exs diff --git a/README.md b/README.md index 3ce7f8e..31ac34b 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,8 @@ To start your Phoenix server: + * Copy `config/dev.secret.sample.exs` to `config/dev.secret.exs` + * Fill in the SMTP and database configuration in `config/dev.secret.exs` * Install dependencies with `mix deps.get` * Create and migrate your database with `mix ecto.setup` * Install Node.js dependencies with `npm install` inside the `assets` directory diff --git a/config/dev.exs b/config/dev.exs index d742c73..ccf4f8a 100644 --- a/config/dev.exs +++ b/config/dev.exs @@ -1,14 +1,5 @@ use Mix.Config -# Configure your database -config :ketbin, Ketbin.Repo, - username: "postgres", - password: "postgres", - database: "ketbin_dev", - hostname: "localhost", - show_sensitive_data_on_connection_error: true, - pool_size: 10 - # For development, we disable any cache and enable # debugging and code reloading. # @@ -30,32 +21,6 @@ config :ketbin, KetbinWeb.Endpoint, ] ] -smtp_relay = - System.get_env("SWOOSH_SMTP_RELAY") || - raise """ - environment variable SWOOSH_SMTP_RELAY is missing. - """ -username = - System.get_env("SWOOSH_USERNAME") || - raise """ - environment variable SWOOSH_USERNAME is missing. - """ -password = - System.get_env("SWOOSH_PASSWORD") || - raise """ - environment variable SWOOSH_PASSWORD is missing. - """ - -# configure mailer -config :ketbin, Ketbin.Mailer, - adapter: Swoosh.Adapters.SMTP, - relay: smtp_relay, - username: username, - password: password, - tls: :always, - auth: :always, - port: 587 - # ## SSL Support # # In order to use HTTPS in development, a self-signed @@ -100,3 +65,6 @@ config :phoenix, :stacktrace_depth, 20 # Initialize plugs at runtime for faster development compilation config :phoenix, :plug_init_mode, :runtime + +# Import the secrets config +import_config "dev.secret.exs" diff --git a/config/dev.secret.sample.exs b/config/dev.secret.sample.exs new file mode 100644 index 0000000..2c8b866 --- /dev/null +++ b/config/dev.secret.sample.exs @@ -0,0 +1,24 @@ +import Mix.Config + +# Configure your database +config :ketbin, Ketbin.Repo, + username: "postgres", + password: "postgres", + database: "ketbin_dev", + hostname: "localhost", + show_sensitive_data_on_connection_error: true, + pool_size: 10 + +smtp_relay = "" +username = "" +password = "" + +# configure mailer +config :ketbin, Ketbin.Mailer, + adapter: Swoosh.Adapters.SMTP, + relay: smtp_relay, + username: username, + password: password, + tls: :always, + auth: :always, + port: 587 diff --git a/lib/ketbin_web/router.ex b/lib/ketbin_web/router.ex index 16300a7..9d6539d 100644 --- a/lib/ketbin_web/router.ex +++ b/lib/ketbin_web/router.ex @@ -59,7 +59,9 @@ defmodule KetbinWeb.Router do scope "/" do pipe_through :browser + live_dashboard "/dashboard", metrics: KetbinWeb.Telemetry + forward "/mailbox", Plug.Swoosh.MailboxPreview end end