mirror of
https://github.com/jbranchaud/til
synced 2026-01-07 00:58:02 +00:00
Add Specifying The Server Port as a phoenix til
This commit is contained in:
@@ -7,7 +7,7 @@ variety of languages and technologies. These are things that don't really
|
|||||||
warrant a full blog post. These are mostly things I learn by pairing with
|
warrant a full blog post. These are mostly things I learn by pairing with
|
||||||
smart people at [Hashrocket](http://hashrocket.com/).
|
smart people at [Hashrocket](http://hashrocket.com/).
|
||||||
|
|
||||||
_510 TILs and counting..._
|
_511 TILs and counting..._
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -214,6 +214,7 @@ _510 TILs and counting..._
|
|||||||
- [Bypass Template Rendering](phoenix/bypass-template-rendering.md)
|
- [Bypass Template Rendering](phoenix/bypass-template-rendering.md)
|
||||||
- [Check The Installed Version](phoenix/check-the-installed-version.md)
|
- [Check The Installed Version](phoenix/check-the-installed-version.md)
|
||||||
- [Render A Template To A String](phoenix/render-a-template-to-a-string.md)
|
- [Render A Template To A String](phoenix/render-a-template-to-a-string.md)
|
||||||
|
- [Specifying The Server Port](phoenix/specifying-the-server-port.md)
|
||||||
|
|
||||||
### PostgreSQL
|
### PostgreSQL
|
||||||
|
|
||||||
|
|||||||
30
phoenix/specifying-the-server-port.md
Normal file
30
phoenix/specifying-the-server-port.md
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
# Specifying The Server Port
|
||||||
|
|
||||||
|
Running `mix phx.server` for a Phoenix project with the default settings
|
||||||
|
will attach the server to port `4000`.
|
||||||
|
|
||||||
|
If you'd like to use a different port in development, you can change it in
|
||||||
|
`config/dev.exs`.
|
||||||
|
|
||||||
|
```elixir
|
||||||
|
config :profilex, Profilex.Web.Endpoint,
|
||||||
|
http: [port: 4444],
|
||||||
|
...
|
||||||
|
```
|
||||||
|
|
||||||
|
Alternatively, you can allow it to be configurable from the command line
|
||||||
|
with an environment variable and a fallback port.
|
||||||
|
|
||||||
|
```elixir
|
||||||
|
config :profilex, Profilex.Web.Endpoint,
|
||||||
|
http: [port: System.get_env("PORT") || 4000],
|
||||||
|
...
|
||||||
|
```
|
||||||
|
|
||||||
|
Running
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ PORT=4444 mix phx.server
|
||||||
|
```
|
||||||
|
|
||||||
|
will launch the server on port `4444`.
|
||||||
Reference in New Issue
Block a user