From 8a0a23dd9a66b36df1c4d3fc3497e439a2843944 Mon Sep 17 00:00:00 2001 From: Uri Gorelik Date: Mon, 17 Feb 2020 14:28:22 -0500 Subject: [PATCH] Phoenix walkthrough doc update (#713) * Updated default Phoenix config to reflect latest version * Added steps to generate a secret key base for Phoenix --- docs/guides/phoenix_walkthrough.md | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/docs/guides/phoenix_walkthrough.md b/docs/guides/phoenix_walkthrough.md index 830133ae..3f2907f4 100644 --- a/docs/guides/phoenix_walkthrough.md +++ b/docs/guides/phoenix_walkthrough.md @@ -33,7 +33,6 @@ First let's modify the Phoenix `config/prod.exs` file. Change this section of te ```elixir config :phoenix_distillery, PhoenixDistilleryWeb.Endpoint, - http: [:inet6, port: System.get_env("PORT") || 4000], url: [host: "example.com", port: 80], cache_static_manifest: "priv/static/cache_manifest.json" ``` @@ -42,14 +41,35 @@ to the following: ```elixir config :phoenix_distillery, PhoenixDistilleryWeb.Endpoint, - http: [:inet6, port: System.get_env("PORT") || 4000], - url: [host: "localhost", port: System.get_env("PORT")], # This is critical for ensuring web-sockets properly authorize. + http: [:inet6, port: {:system, "PORT"}], + url: [host: "localhost", port: {:system, "PORT"}], # This is critical for ensuring web-sockets properly authorize. cache_static_manifest: "priv/static/cache_manifest.json", server: true, root: ".", version: Application.spec(:phoenix_distillery, :vsn) ``` +We also need to change the secret key base in `config/prod.secret.exs` . Change this section of text: + +```elixir +secret_key_base = + System.get_env("SECRET_KEY_BASE") || + raise """ + environment variable SECRET_KEY_BASE is missing. + You can generate one by calling: mix phx.gen.secret + """ +``` + +to the following: + +```elixir +secret_key_base = + "5U8dBbveeM1DMJtFZq6Ybaum394cVHDHHj/YnKo8r8461WS9eFDWT2YpLzuODsan" +``` + +**NOTE** The secret key base should be generated using `mix phx.gen.secret`. It +should also not be committed to your VCS in plain text. + Let's discuss these options. - `server` configures the endpoint to boot the [Cowboy](https://github.com/ninenines/cowboy) application http endpoint on start.