Define kafka brokers per env

This commit is contained in:
2022-02-20 23:29:21 +01:00
parent cfac9dfbd4
commit e84ebe58f1
4 changed files with 18 additions and 2 deletions

View File

@@ -41,7 +41,6 @@ config :kafka_ex,
# {"kafka2", 9092}, # {"kafka2", 9092},
# {"kafka3", 9092} # {"kafka3", 9092}
# ], # ],
brokers: "localhost:9093,localhost:9094,localhost:9095",
# #
# OR: # OR:
# brokers: "localhost:9092,localhost:9093,localhost:9094" # brokers: "localhost:9092,localhost:9093,localhost:9094"
@@ -96,4 +95,8 @@ config :kafka_ex,
# Import environment specific config. This must remain at the bottom # Import environment specific config. This must remain at the bottom
# of this file so it overrides the configuration defined above. # of this file so it overrides the configuration defined above.
import_config "#{config_env()}.exs" env_config = Path.expand("#{Mix.env()}.exs", __DIR__)
if File.exists?(env_config) do
import_config(env_config)
end

View File

@@ -49,3 +49,6 @@ config :phoenix, :stacktrace_depth, 20
# Initialize plugs at runtime for faster development compilation # Initialize plugs at runtime for faster development compilation
config :phoenix, :plug_init_mode, :runtime config :phoenix, :plug_init_mode, :runtime
config :kafka_ex,
brokers: "localhost:9093,localhost:9094,localhost:9095"

View File

@@ -48,3 +48,10 @@ config :logger, level: :info
# force_ssl: [hsts: true] # force_ssl: [hsts: true]
# #
# Check `Plug.SSL` for all available options in `force_ssl`. # Check `Plug.SSL` for all available options in `force_ssl`.
config :kafka_ex,
brokers: [
{System.get_env("KAFKA_BROKER_1_HOST"), System.get_env("KAFKA_BROKER_1_PORT")},
{System.get_env("KAFKA_BROKER_2_HOST"), System.get_env("KAFKA_BROKER_2_PORT")},
{System.get_env("KAFKA_BROKER_3_HOST"), System.get_env("KAFKA_BROKER_3_PORT")}
]

View File

@@ -12,3 +12,6 @@ config :logger, level: :warn
# Initialize plugs at runtime for faster test compilation # Initialize plugs at runtime for faster test compilation
config :phoenix, :plug_init_mode, :runtime config :phoenix, :plug_init_mode, :runtime
config :kafka_ex,
disable_default_worker: true