From 670d06b7a842088864b51b4978c57c7d62572e34 Mon Sep 17 00:00:00 2001 From: Joao P Dubas Date: Fri, 20 Sep 2024 22:04:20 +0000 Subject: [PATCH] chore: remove boilerplate comments --- config/config.exs | 12 ---------- config/dev.exs | 35 --------------------------- config/prod.exs | 48 -------------------------------------- config/runtime.exs | 28 ++++++++++++++++++++++ config/test.exs | 8 ------- lib/wabanex/application.ex | 13 ----------- 6 files changed, 28 insertions(+), 116 deletions(-) diff --git a/config/config.exs b/config/config.exs index 0702aa3..387793c 100644 --- a/config/config.exs +++ b/config/config.exs @@ -1,10 +1,3 @@ -# This file is responsible for configuring your application -# and its dependencies with the aid of the Mix.Config module. -# -# This configuration file is loaded before any dependency and -# is restricted to this project. - -# General application configuration import Config config :wabanex, @@ -21,7 +14,6 @@ config :wabanex, Wabanex.PromEx, grafana: :disabled, metrics_server: :disabled -# Configures the endpoint config :wabanex, WabanexWeb.Endpoint, url: [host: "localhost"], secret_key_base: "wkyuhU+mCGwXUSBYVKZSRGoFmDYCbOFzdokbVmBBI9JgCWOqGPfuA/3JI5/b4Wdl", @@ -29,14 +21,10 @@ config :wabanex, WabanexWeb.Endpoint, pubsub_server: Wabanex.PubSub, live_view: [signing_salt: "SXtw7DzV"] -# Configures Elixir's Logger config :logger, :console, format: "$time $metadata[$level] $message\n", metadata: [:request_id] -# Use Jason for JSON parsing in Phoenix config :phoenix, :json_library, Jason -# 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" diff --git a/config/dev.exs b/config/dev.exs index 955f22a..9cea01d 100644 --- a/config/dev.exs +++ b/config/dev.exs @@ -4,18 +4,11 @@ config :wabanex, dns_cluster_query: :ignore, dns_cluster_resolver: Wabanex.DevDNSClusterResolver -# Configure your database config :wabanex, Wabanex.Repo, database: "wabanex_dev", show_sensitive_data_on_connection_error: true, pool_size: 10 -# For development, we disable any cache and enable -# debugging and code reloading. -# -# The watchers configuration can be used to run external -# watchers to your application. For example, we use it -# with webpack to recompile .js and .css sources. config :wabanex, WabanexWeb.Endpoint, http: [port: 4000], debug_errors: true, @@ -23,36 +16,8 @@ config :wabanex, WabanexWeb.Endpoint, check_origin: false, watchers: [] -# ## SSL Support -# -# In order to use HTTPS in development, a self-signed -# certificate can be generated by running the following -# Mix task: -# -# mix phx.gen.cert -# -# Note that this task requires Erlang/OTP 20 or later. -# Run `mix help phx.gen.cert` for more information. -# -# The `http:` config above can be replaced with: -# -# https: [ -# port: 4001, -# cipher_suite: :strong, -# keyfile: "priv/cert/selfsigned_key.pem", -# certfile: "priv/cert/selfsigned.pem" -# ], -# -# If desired, both `http:` and `https:` keys can be -# configured to run both http and https servers on -# different ports. - -# Do not include metadata nor timestamps in development logs config :logger, :console, format: "[$level] $message\n" -# Set a higher stacktrace during development. Avoid configuring such -# in production as building large stacktraces may be expensive. config :phoenix, :stacktrace_depth, 20 -# Initialize plugs at runtime for faster development compilation config :phoenix, :plug_init_mode, :runtime diff --git a/config/prod.exs b/config/prod.exs index 10f9447..9671347 100644 --- a/config/prod.exs +++ b/config/prod.exs @@ -1,55 +1,7 @@ import Config -# For production, don't forget to configure the url host -# to something meaningful, Phoenix uses this information -# when generating URLs. -# -# Note we also include the path to a cache manifest -# containing the digested version of static files. This -# manifest is generated by the `mix phx.digest` task, -# which you should run after static files are built and -# before starting your production server. config :wabanex, WabanexWeb.Endpoint, url: [host: "example.com", port: 80], cache_static_manifest: "priv/static/cache_manifest.json" -# Do not print debug messages in production config :logger, level: :info - -# ## SSL Support -# -# To get SSL working, you will need to add the `https` key -# to the previous section and set your `:url` port to 443: -# -# config :wabanex, WabanexWeb.Endpoint, -# ... -# url: [host: "example.com", port: 443], -# https: [ -# port: 443, -# cipher_suite: :strong, -# keyfile: System.get_env("SOME_APP_SSL_KEY_PATH"), -# certfile: System.get_env("SOME_APP_SSL_CERT_PATH"), -# transport_options: [socket_opts: [:inet6]] -# ] -# -# The `cipher_suite` is set to `:strong` to support only the -# latest and more secure SSL ciphers. This means old browsers -# and clients may not be supported. You can set it to -# `:compatible` for wider support. -# -# `:keyfile` and `:certfile` expect an absolute path to the key -# and cert in disk or a relative path inside priv, for example -# "priv/ssl/server.key". For all supported SSL configuration -# options, see https://hexdocs.pm/plug/Plug.SSL.html#configure/1 -# -# We also recommend setting `force_ssl` in your endpoint, ensuring -# no data is ever sent via http, always redirecting to https: -# -# config :wabanex, WabanexWeb.Endpoint, -# force_ssl: [hsts: true] -# -# Check `Plug.SSL` for all available options in `force_ssl`. - -# Finally import the config/prod.secret.exs which loads secrets -# and configuration from environment variables. -import_config "prod.secret.exs" diff --git a/config/runtime.exs b/config/runtime.exs index 90fc85f..bc5dec1 100644 --- a/config/runtime.exs +++ b/config/runtime.exs @@ -1,5 +1,33 @@ import Config +# [warn] Conditional IPv6 support missing from runtime configuration. +# +# Add the following to your config/runtime.exs: +# +# maybe_ipv6 = if System.get_env("ECTO_IPV6") in ~w(true 1), do: [:inet6], else: [] +# +# config :wabanex, Wabanex.Repo, +# ..., +# socket_options: maybe_ipv6 +# +# [warn] Conditional server startup is missing from runtime configuration. +# +# Add the following to the top of your config/runtime.exs: +# +# if System.get_env("PHX_SERVER") do +# config :wabanex, WabanexWeb.Endpoint, server: true +# end +# +# [warn] Environment based URL export is missing from runtime configuration. +# +# Add the following to your config/runtime.exs: +# +# host = System.get_env("PHX_HOST") || "example.com" +# +# config :wabanex, WabanexWeb.Endpoint, +# ..., +# url: [host: host, port: 443] + config :wabanex, dns_cluster_query: System.get_env("DNS_CLUSTER_QUERY") || :ignore config :wabanex, Wabanex.Repo, diff --git a/config/test.exs b/config/test.exs index c5b87de..4b124fa 100644 --- a/config/test.exs +++ b/config/test.exs @@ -1,21 +1,13 @@ import Config -# Configure your database -# -# The MIX_TEST_PARTITION environment variable can be used -# to provide built-in test partitioning in CI environment. -# Run `mix help test` for more information. config :wabanex, Wabanex.Repo, database: "wabanex_test#{System.get_env("MIX_TEST_PARTITION")}", pool: Ecto.Adapters.SQL.Sandbox -# We don't run a server during test. If one is required, -# you can enable the server option below. config :wabanex, WabanexWeb.Endpoint, http: [port: 4002], server: false -# Print only warnings and errors during test config :logger, level: :warning config :junit_formatter, diff --git a/lib/wabanex/application.ex b/lib/wabanex/application.ex index 536404e..346d587 100644 --- a/lib/wabanex/application.ex +++ b/lib/wabanex/application.ex @@ -1,38 +1,25 @@ defmodule Wabanex.Application do - # See https://hexdocs.pm/elixir/Application.html - # for more information on OTP Applications @moduledoc false use Application def start(_type, _args) do children = [ - # Start the PromEx supervisor Wabanex.PromEx, - # Start the Ecto repository Wabanex.Repo, - # Start the Telemetry supervisor WabanexWeb.Telemetry, - # Start the PubSub system {Phoenix.PubSub, name: Wabanex.PubSub}, {DNSCluster, query: Application.get_env(:wabanex, :dns_cluster_query) || :ignore, log: :info, resolver: Application.get_env(:wabanex, :dns_cluster_resolver) || DNSCluster.Resolver}, - # Start the Endpoint (http/https) WabanexWeb.Endpoint - # Start a worker by calling: Wabanex.Worker.start_link(arg) - # {Wabanex.Worker, arg} ] - # See https://hexdocs.pm/elixir/Supervisor.html - # for other strategies and supported options opts = [strategy: :one_for_one, name: Wabanex.Supervisor] Supervisor.start_link(children, opts) end - # Tell Phoenix to update the endpoint configuration - # whenever the application is updated. def config_change(changed, _new, removed) do WabanexWeb.Endpoint.config_change(changed, removed) :ok