Surgex v2.24.1 Surgex.RepoHelpers
Tools for dynamic setup of Ecto repo opts.
Summary
Functions
Sets repo options from env vars starting with specified prefix
Sets repo database pool size from specified env var only if Phoenix server is configured to run
Sets repo database URL from specified env var
Functions
Sets repo options from env vars starting with specified prefix.
Examples
iex> System.put_env("DATABASE_URL", "postgres://localhost")
iex> System.put_env("DATABASE_SERVER_POOL_SIZE", "30")
iex> Application.put_env(:phoenix, :serve_endpoints, true)
iex>
iex> final_opts = Surgex.RepoHelpers.set_opts([])
iex>
iex> Keyword.get(final_opts, :url)
"postgres://localhost"
iex> Keyword.get(final_opts, :pool_size)
30
Sets repo database pool size from specified env var only if Phoenix server is configured to run.