Skip to content

Commit

Permalink
Phoenix walkthrough doc update (bitwalker#713)
Browse files Browse the repository at this point in the history
* Updated default Phoenix config to reflect latest version
* Added steps to generate a secret key base for Phoenix
  • Loading branch information
Uri Gorelik authored Feb 17, 2020
1 parent bdbc348 commit 8a0a23d
Showing 1 changed file with 23 additions and 3 deletions.
26 changes: 23 additions & 3 deletions docs/guides/phoenix_walkthrough.md
Original file line number Diff line number Diff line change
Expand Up @@ -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"
```
Expand All @@ -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.
Expand Down

0 comments on commit 8a0a23d

Please sign in to comment.