add host variable

This commit is contained in:
Lili (Tlapka) 2021-10-19 18:23:13 +02:00
parent 00903226a7
commit 6746119b20
2 changed files with 8 additions and 2 deletions

View File

@ -24,7 +24,7 @@ To run the application in prod, you need to do some additional setup. Essentiall
1. `export` the SECRET_KEY_BASE and DATABASE_URL bash variables. You can get a secret with `mix phx.gen.secret`. 1. `export` the SECRET_KEY_BASE and DATABASE_URL bash variables. You can get a secret with `mix phx.gen.secret`.
2. Run `npm install` in the `assets` subfolder, then run `npm run deploy --prefix ./assets` in the project root folder. 2. Run `npm install` in the `assets` subfolder, then run `npm run deploy --prefix ./assets` in the project root folder.
3. Run `mix phx.digest` in the root folder. 3. Run `mix phx.digest` in the root folder.
4. Run the server with PORT and MIX_ENV variables set, i.e. `PORT=4001 MIX_ENV=prod mix phx.server` (or `PORT=4001 MIX_ENV=prod elixir --erl "-detached" -S mix phx.server`). 4. Run the server with PORT, HOST and MIX_ENV variables set, i.e. `PORT=4001 MIX_ENV=prod HOST=couture.pikachu.rocks mix phx.server` (or `PORT=4001 MIX_ENV=prod HOST=couture.pikachu.rocks elixir --erl "-detached" -S mix phx.server`).
## License and attributions ## License and attributions
`assets/static/images/pikachu.png` is a [pikachu icon by WEBTECHOPS LLP from the Noun Project](https://thenounproject.com/term/pokemon/2122740/), licensed as Creative Commons CCBY. `assets/static/images/pikachu.png` is a [pikachu icon by WEBTECHOPS LLP from the Noun Project](https://thenounproject.com/term/pokemon/2122740/), licensed as Creative Commons CCBY.

View File

@ -9,8 +9,14 @@ use Mix.Config
# manifest is generated by the `mix phx.digest` task, # manifest is generated by the `mix phx.digest` task,
# which you should run after static files are built and # which you should run after static files are built and
# before starting your production server. # before starting your production server.
host =
System.get_env("HOST") ||
raise """
environment variable HOST is missing.
"""
config :pokemon_couture, PokemonCoutureWeb.Endpoint, config :pokemon_couture, PokemonCoutureWeb.Endpoint,
url: [host: "example.com", port: 80], url: [host: host, port: 80],
cache_static_manifest: "priv/static/cache_manifest.json" cache_static_manifest: "priv/static/cache_manifest.json"
# Do not print debug messages in production # Do not print debug messages in production