diff --git a/config/config.exs b/config/config.exs index db2ab93..f811459 100644 --- a/config/config.exs +++ b/config/config.exs @@ -41,7 +41,6 @@ config :kafka_ex, # {"kafka2", 9092}, # {"kafka3", 9092} # ], - brokers: "localhost:9093,localhost:9094,localhost:9095", # # OR: # brokers: "localhost:9092,localhost:9093,localhost:9094" @@ -96,4 +95,8 @@ config :kafka_ex, # Import environment specific config. This must remain at the bottom # 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 diff --git a/config/dev.exs b/config/dev.exs index f9b637b..85df554 100644 --- a/config/dev.exs +++ b/config/dev.exs @@ -49,3 +49,6 @@ config :phoenix, :stacktrace_depth, 20 # Initialize plugs at runtime for faster development compilation config :phoenix, :plug_init_mode, :runtime + +config :kafka_ex, + brokers: "localhost:9093,localhost:9094,localhost:9095" diff --git a/config/prod.exs b/config/prod.exs index a63203a..93d901c 100644 --- a/config/prod.exs +++ b/config/prod.exs @@ -48,3 +48,10 @@ config :logger, level: :info # force_ssl: [hsts: true] # # 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")} + ] diff --git a/config/test.exs b/config/test.exs index 6845ddb..913563e 100644 --- a/config/test.exs +++ b/config/test.exs @@ -12,3 +12,6 @@ config :logger, level: :warn # Initialize plugs at runtime for faster test compilation config :phoenix, :plug_init_mode, :runtime + +config :kafka_ex, + disable_default_worker: true