Support custom database port through environment DATABASE_PORT env var

Based on example from https://github.com/elixir-ecto/ecto
This commit is contained in:
Marcus Vaal
2019-07-26 23:39:08 -05:00
committed by Adrian Kumpf
parent 9cff83afb7
commit 9bb1b446ea
2 changed files with 2 additions and 0 deletions

View File

@@ -243,6 +243,7 @@ TeslaMate uses environment variables for runtime configuration.
| DATABASE_PASS | User password (**required**) | / |
| DATABASE_NAME | The database to connect to (**required**) | / |
| DATABASE_HOST | Hostname of the database server (**required**) | / |
| DATABASE_PORT | Port of the database server | 5432 |
| DATABASE_POOL_SIZE | Size of the database connection pool | 5 |
| TESLA_USERNAME | Username / email of your Tesla account (**required**) | / |
| TESLA_PASSWORD | Password of your Tesla account (**required**) | / |

View File

@@ -13,6 +13,7 @@ config :teslamate, TeslaMate.Repo,
password: System.fetch_env!("DATABASE_PASS"),
database: System.fetch_env!("DATABASE_NAME"),
hostname: System.fetch_env!("DATABASE_HOST"),
port: System.get_env("DATABASE_PORT", "5432"),
pool_size: System.get_env("DATABASE_POOL_SIZE", "5") |> String.to_integer()
config :teslamate, TeslaMateWeb.Endpoint,