changing how we store the database information in the env file
This commit is contained in:
@@ -5,7 +5,11 @@ PORT=4000
|
||||
SECRET_KEY_BASE=REPLACE_WITH_64_CHAR_SECRET # generate with: mix phx.gen.secret
|
||||
|
||||
# Database
|
||||
DATABASE_URL=ecto://USER:PASSWORD@HOST/DATABASE
|
||||
DB_USER=postgres
|
||||
DB_PASS=postgres
|
||||
DB_HOST=localhost
|
||||
DB_NAME=mixer
|
||||
DB_PORT=5432
|
||||
ECTO_IPV6=false
|
||||
POOL_SIZE=10
|
||||
|
||||
|
||||
@@ -23,18 +23,15 @@ end
|
||||
config :mixer, MixerWeb.Endpoint, http: [port: String.to_integer(System.get_env("PORT", "4000"))]
|
||||
|
||||
if config_env() == :prod do
|
||||
database_url =
|
||||
System.get_env("DATABASE_URL") ||
|
||||
raise """
|
||||
environment variable DATABASE_URL is missing.
|
||||
For example: ecto://USER:PASS@HOST/DATABASE
|
||||
"""
|
||||
|
||||
maybe_ipv6 = if System.get_env("ECTO_IPV6") in ~w(true 1), do: [:inet6], else: []
|
||||
|
||||
config :mixer, Mixer.Repo,
|
||||
# ssl: true,
|
||||
url: database_url,
|
||||
username: System.get_env("DB_USER") || raise("Missing environment variable `DB_USER`!"),
|
||||
password: System.get_env("DB_PASS") || raise("Missing environment variable `DB_PASS`!"),
|
||||
host: System.get_env("DB_HOST") || raise("Missing environment variable `DB_HOST`!"),
|
||||
database: System.get_env("DB_NAME") || raise("Missing environment variable `DB_NAME`!"),
|
||||
port: String.to_integer(System.get_env("DB_PORT", "5432")),
|
||||
pool_size: String.to_integer(System.get_env("POOL_SIZE") || "10"),
|
||||
# For machines with several cores, consider starting multiple pools of `pool_size`
|
||||
# pool_count: 4,
|
||||
|
||||
Reference in New Issue
Block a user