Skip to content

Commit

Permalink
chore: add credo checks on config files too (#1704)
Browse files Browse the repository at this point in the history
  • Loading branch information
sborrazas committed Mar 21, 2024
1 parent e0ba8ae commit b009208
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
1 change: 1 addition & 0 deletions .credo.exs
Expand Up @@ -22,6 +22,7 @@
# In the latter case `**/*.{ex,exs}` will be used.
#
included: [
"config/",
"lib/",
"src/",
"test/",
Expand Down
12 changes: 9 additions & 3 deletions config/runtime.exs
Expand Up @@ -55,23 +55,29 @@ log_level =
"notice" -> :notice
"info" -> :info
"debug" -> :debug
_ -> nil
_level -> nil
end

if not is_nil(log_level) do
config :logger,
level: log_level
end

formatters = %{
"datadog" => :datadog,
"standard" => :standard
}

if env in [:test, :prod] do
if System.get_env("ENABLE_TELEMETRY", "false") in ["true", "1"] do
{:ok, hostname} = :inet.gethostname()
host = System.get_env("TELEMETRY_STATSD_HOST") || to_string(hostname)
port = String.to_integer(System.get_env("TELEMETRY_STATSD_PORT", "8125"))
formatter = System.get_env("TELEMETRY_STATSD_FORMAT", "datadog")
formatter_str = System.get_env("TELEMETRY_STATSD_FORMAT", "datadog")
formatter = Map.fetch!(formatters, formatter_str)

config :ae_mdw, TelemetryMetricsStatsd,
formatter: String.to_atom(formatter),
formatter: String.to_existing_atom(formatter),
host: host,
port: port
end
Expand Down

0 comments on commit b009208

Please sign in to comment.