51 lines
1.8 KiB
Elixir
51 lines
1.8 KiB
Elixir
import Config
|
|
|
|
# config/runtime.exs is executed for all environments, including
|
|
# during releases. It is executed after compilation and before the
|
|
# system starts, so it is typically used to load production configuration
|
|
# and secrets from environment variables or elsewhere. Do not define
|
|
# any compile-time configuration in here, as it won't be applied.
|
|
# The block below contains prod specific runtime configuration.
|
|
|
|
# Start the phoenix server if environment is set and running in a release
|
|
if System.get_env("PHX_SERVER") && System.get_env("RELEASE_NAME") do
|
|
config :kafkaex_lag_exporter, KafkaexLagExporterWeb.Endpoint, server: true
|
|
end
|
|
|
|
if config_env() == :prod do
|
|
host = System.get_env("PHX_HOST") || "localhost"
|
|
port = String.to_integer(System.get_env("PORT") || "4000")
|
|
|
|
config :kafkaex_lag_exporter, KafkaexLagExporterWeb.Endpoint,
|
|
url: [host: host, port: 443],
|
|
http: [
|
|
# Enable IPv6 and bind on all interfaces.
|
|
# Set it to {0, 0, 0, 0, 0, 0, 0, 1} for local network only access.
|
|
# See the documentation on https://hexdocs.pm/plug_cowboy/Plug.Cowboy.html
|
|
# for details about using IPv6 vs IPv4 and loopback vs public addresses.
|
|
ip: {0, 0, 0, 0, 0, 0, 0, 0},
|
|
port: port
|
|
]
|
|
|
|
# ## Using releases
|
|
#
|
|
# If you are doing OTP releases, you need to instruct Phoenix
|
|
# to start each relevant endpoint:
|
|
#
|
|
# config :kafkaex_lag_exporter, KafkaexLagExporterWeb.Endpoint, server: true
|
|
#
|
|
# Then you can assemble a release by calling `mix release`.
|
|
# See `mix help release` for more information.
|
|
end
|
|
|
|
{port, _} =
|
|
System.fetch_env!("KAFKA_BROKER_PORT")
|
|
|> Integer.parse()
|
|
|
|
config :kafka_ex,
|
|
brokers: [
|
|
{System.fetch_env!("KAFKA_BROKER1_HOST"), port},
|
|
{System.fetch_env!("KAFKA_BROKER2_HOST"), port},
|
|
{System.fetch_env!("KAFKA_BROKER3_HOST"), port}
|
|
]
|