Skip to content

Commit 1b29c8b

Browse files
committed
mix format
1 parent 9afdc61 commit 1b29c8b

File tree

12 files changed

+206
-198
lines changed

12 files changed

+206
-198
lines changed

config/config.exs

+48-49
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,5 @@
11
import Config
22

3-
config :phoenix_container_example,
4-
foo: "default"
5-
6-
config :phoenix_container_example,
7-
ecto_repos: [PhoenixContainerExample.Repo],
8-
generators: [timestamp_type: :utc_datetime]
9-
10-
config :phoenix_container_example, PhoenixContainerExampleWeb.Endpoint,
11-
url: [host: "localhost"],
12-
adapter: Phoenix.Endpoint.Cowboy2Adapter,
13-
render_errors: [
14-
formats: [
15-
html: PhoenixContainerExampleWeb.ErrorHTML,
16-
json: PhoenixContainerExampleWeb.ErrorJSON
17-
],
18-
layout: false
19-
],
20-
pubsub_server: PhoenixContainerExample.PubSub,
21-
live_view: [signing_salt: "Mywi6aA5"]
22-
23-
# Configures the mailer
24-
#
25-
# By default it uses the "Local" adapter which stores the emails
26-
# locally. You can see the emails in your browser, at "/dev/mailbox".
27-
#
28-
# For production it's recommended to configure a different adapter
29-
# at the `config/runtime.exs`.
30-
config :phoenix_container_example, PhoenixContainerExample.Mailer, adapter: Swoosh.Adapters.Local
31-
323
# Configure esbuild (the version is required)
334
config :esbuild,
345
version: "0.17.11",
@@ -38,30 +9,12 @@ config :esbuild,
389
env: %{"NODE_PATH" => Path.expand("../deps", __DIR__)}
3910
]
4011

41-
# Configure tailwind (the version is required)
42-
config :tailwind,
43-
version: "3.3.2",
44-
default: [
45-
args: ~w(
46-
--config=tailwind.config.js
47-
--input=css/app.css
48-
--output=../priv/static/assets/app.css
49-
),
50-
cd: Path.expand("../assets", __DIR__)
51-
]
52-
53-
config :logger,
54-
level: :info
55-
5612
config :logger, :default_formatter,
5713
format: "$time $metadata[$level] $message\n",
5814
metadata: [:file, :line, :request_id, :otel_trace_id, :otel_span_id, :xray_trace_id]
5915

60-
config :opentelemetry,
61-
id_generator: :opentelemetry_xray_id_generator,
62-
propagators: [:opentelemetry_xray_propagator, :baggage]
63-
64-
# resource_detectors: [:otel_resource_env_var, :otel_resource_app_env]
16+
config :logger,
17+
level: :info
6518

6619
# https://opentelemetry.io/docs/reference/specification/resource/semantic_conventions/
6720
config :opentelemetry, :resource, [
@@ -71,11 +24,57 @@ config :opentelemetry, :resource, [
7124
{"service.version", Mix.Project.config()[:version]}
7225
]
7326

27+
config :opentelemetry,
28+
id_generator: :opentelemetry_xray_id_generator,
29+
propagators: [:opentelemetry_xray_propagator, :baggage]
30+
7431
# Use Jason for JSON parsing in Phoenix
32+
# Configures the mailer
33+
#
34+
# By default it uses the "Local" adapter which stores the emails
7535
config :phoenix, :json_library, Jason
7636

7737
# Disable normal Phoenix.Logger, as we are using uinta
38+
# locally. You can see the emails in your browser, at "/dev/mailbox".
7839
# https://github.com/podium/uinta
40+
#
41+
# For production it's recommended to configure a different adapter
42+
# at the `config/runtime.exs`.
7943
config :phoenix, logger: false
8044

45+
config :phoenix_container_example, PhoenixContainerExample.Mailer, adapter: Swoosh.Adapters.Local
46+
47+
config :phoenix_container_example, PhoenixContainerExampleWeb.Endpoint,
48+
url: [host: "localhost"],
49+
adapter: Phoenix.Endpoint.Cowboy2Adapter,
50+
render_errors: [
51+
formats: [
52+
html: PhoenixContainerExampleWeb.ErrorHTML,
53+
json: PhoenixContainerExampleWeb.ErrorJSON
54+
],
55+
layout: false
56+
],
57+
pubsub_server: PhoenixContainerExample.PubSub,
58+
live_view: [signing_salt: "Mywi6aA5"]
59+
60+
config :phoenix_container_example,
61+
ecto_repos: [PhoenixContainerExample.Repo],
62+
generators: [timestamp_type: :utc_datetime]
63+
64+
config :phoenix_container_example,
65+
foo: "default"
66+
67+
# Configure tailwind (the version is required)
68+
config :tailwind,
69+
version: "3.3.2",
70+
default: [
71+
# resource_detectors: [:otel_resource_env_var, :otel_resource_app_env]
72+
args: ~w(
73+
--config=tailwind.config.js
74+
--input=css/app.css
75+
--output=../priv/static/assets/app.css
76+
),
77+
cd: Path.expand("../assets", __DIR__)
78+
]
79+
8180
import_config "#{config_env()}.exs"

config/dev.exs

+61-58
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,53 @@
11
import Config
22

3+
config :logger, :default_handler,
4+
filters: [
5+
# Elixir default filter
6+
remote_gl: {&:logger_filters.remote_gl/2, :stop},
7+
# Format trace_id for X-Ray
8+
opentelemetry_trace_id: {&:opentelemetry_xray_logger_filter.trace_id/2, %{}}
9+
],
10+
formatter: {
11+
:logger_formatter_json,
12+
%{
13+
template: [
14+
:msg,
15+
# :time,
16+
:level,
17+
:file,
18+
:line,
19+
# :mfa,
20+
:pid,
21+
:request_id,
22+
:otel_trace_id,
23+
:otel_span_id,
24+
:otel_trace_flags,
25+
:xray_trace_id,
26+
:rest
27+
]
28+
}
29+
30+
# ## SSL Support
31+
#
32+
# In order to use HTTPS in development, a self-signed
33+
# certificate can be generated by running the following
34+
# Mix task:
35+
#
36+
# mix phx.gen.cert
37+
#
38+
# Run `mix help phx.gen.cert` for more information.
39+
#
40+
# The `http:` config above can be replaced with:
41+
#
42+
# https: [
43+
# port: 4001,
44+
# cipher_suite: :strong,
45+
}
46+
47+
config :logger,
48+
level: :debug,
49+
always_evaluate_messages: true
50+
351
config :phoenix_container_example, PhoenixContainerExample.Repo,
452
username: System.get_env("DATABASE_USER") || "postgres",
553
password: System.get_env("DATABASE_PASS") || "postgres",
@@ -11,8 +59,18 @@ config :phoenix_container_example, PhoenixContainerExample.Repo,
1159

1260
config :phoenix_container_example, PhoenixContainerExampleWeb.Endpoint,
1361
# Binding to loopback ipv4 address prevents access from other machines.
62+
# keyfile: "priv/cert/selfsigned_key.pem",
63+
1464
# Change to `ip: {0, 0, 0, 0}` to allow access from other machines.
65+
# certfile: "priv/cert/selfsigned.pem"
66+
1567
# http: [ip: {127, 0, 0, 1}, port: 4000],
68+
# ],
69+
#
70+
# If desired, both `http:` and `https:` keys can be
71+
# configured to run both http and https servers on
72+
# different ports.
73+
1674
http: [port: String.to_integer(System.get_env("PORT") || "4000")],
1775
check_origin: false,
1876
code_reloader: true,
@@ -23,29 +81,6 @@ config :phoenix_container_example, PhoenixContainerExampleWeb.Endpoint,
2381
tailwind: {Tailwind, :install_and_run, [:default, ~w(--watch)]}
2482
]
2583

26-
# ## SSL Support
27-
#
28-
# In order to use HTTPS in development, a self-signed
29-
# certificate can be generated by running the following
30-
# Mix task:
31-
#
32-
# mix phx.gen.cert
33-
#
34-
# Run `mix help phx.gen.cert` for more information.
35-
#
36-
# The `http:` config above can be replaced with:
37-
#
38-
# https: [
39-
# port: 4001,
40-
# cipher_suite: :strong,
41-
# keyfile: "priv/cert/selfsigned_key.pem",
42-
# certfile: "priv/cert/selfsigned.pem"
43-
# ],
44-
#
45-
# If desired, both `http:` and `https:` keys can be
46-
# configured to run both http and https servers on
47-
# different ports.
48-
4984
# Watch static and templates for browser reloading.
5085
config :phoenix_container_example, PhoenixContainerExampleWeb.Endpoint,
5186
live_reload: [
@@ -59,42 +94,10 @@ config :phoenix_container_example, PhoenixContainerExampleWeb.Endpoint,
5994
# Enable dev routes for dashboard and mailbox
6095
config :phoenix_container_example, dev_routes: true
6196

62-
config :logger,
63-
level: :debug,
64-
always_evaluate_messages: true
65-
6697
# config :logger, :default_formatter,
6798
# format: "$time $metadata[$level] $message\n",
6899
# metadata: [:file, :line]
69100

70-
config :logger, :default_handler,
71-
filters: [
72-
# Elixir default filter
73-
remote_gl: {&:logger_filters.remote_gl/2, :stop},
74-
# Format trace_id for X-Ray
75-
opentelemetry_trace_id: {&:opentelemetry_xray_logger_filter.trace_id/2, %{}}
76-
],
77-
formatter: {
78-
:logger_formatter_json,
79-
%{
80-
template: [
81-
:msg,
82-
# :time,
83-
:level,
84-
:file,
85-
:line,
86-
# :mfa,
87-
:pid,
88-
:request_id,
89-
:otel_trace_id,
90-
:otel_span_id,
91-
:otel_trace_flags,
92-
:xray_trace_id,
93-
:rest
94-
]
95-
}
96-
}
97-
98101
if System.get_env("OTEL_DEBUG") == "true" do
99102
config :opentelemetry, :processors,
100103
otel_batch_processor: %{
@@ -104,13 +107,13 @@ else
104107
config :opentelemetry, traces_exporter: :none
105108
end
106109

110+
# Initialize plugs at runtime for faster development compilation
111+
config :phoenix, :plug_init_mode, :runtime
112+
107113
# Set a higher stacktrace during development. Avoid configuring such
108114
# in production as building large stacktraces may be expensive.
109115
config :phoenix, :stacktrace_depth, 20
110116

111-
# Initialize plugs at runtime for faster development compilation
112-
config :phoenix, :plug_init_mode, :runtime
113-
114117
# Include HEEx debug annotations as HTML comments in rendered markup
115118
config :phoenix_live_view, debug_heex_annotations: true
116119

config/prod.exs

+20-19
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,24 @@
11
import Config
22

3-
config :phoenix_container_example, PhoenixContainerExampleWeb.Endpoint,
4-
cache_static_manifest: "priv/static/cache_manifest.json"
5-
6-
config :phoenix_container_example, Uinta.Plug, format: :map
7-
# Include GraphQL variables in log line
8-
# include_variables: true,
9-
# ignored_paths: [],
10-
# filter_variables: [],
11-
# success_log_sampling_ratio: 1.0,
12-
# include_datadog_fields: false
13-
14-
config :logger, level: :info, utc_log: true
15-
163
config :logger, :default_handler,
174
filters: [
185
# Elixir default filter
196
remote_gl: {&:logger_filters.remote_gl/2, :stop},
207
# Format trace_id for X-Ray
218
opentelemetry_trace_id: {&:opentelemetry_xray_logger_filter.trace_id/2, %{}}
229
],
10+
# Include GraphQL variables in log line
11+
# include_variables: true,
12+
# ignored_paths: [],
13+
# filter_variables: [],
14+
# success_log_sampling_ratio: 1.0,
15+
# include_datadog_fields: false
16+
# :time,
2317
formatter: {
2418
:logger_formatter_json,
2519
%{
2620
template: [
2721
:msg,
28-
# :time,
2922
:level,
3023
:file,
3124
:line,
@@ -41,6 +34,19 @@ config :logger, :default_handler,
4134
}
4235
}
4336

37+
config :logger, level: :info, utc_log: true
38+
39+
# Because we are doing containerized testing, default to same settings as test env.
40+
# Prod settings are handled in runtime.exs if we are actually running in prod.
41+
config :phoenix_container_example, PhoenixContainerExample.Mailer, adapter: Swoosh.Adapters.Test
42+
43+
config :phoenix_container_example, PhoenixContainerExampleWeb.Endpoint,
44+
cache_static_manifest: "priv/static/cache_manifest.json"
45+
46+
config :phoenix_container_example, Uinta.Plug, format: :map
47+
48+
config :swoosh, :api_client, false
49+
4450
# https://hexdocs.pm/opentelemetry_exporter/readme.html
4551
# Set via environment vars because server name is different in docker compose vs ECS:
4652
# OTEL_EXPORTER_OTLP_ENDPOINT="http://localhost:4317"
@@ -64,11 +70,6 @@ config :logger, :default_handler,
6470
# }
6571
# }
6672

67-
# Because we are doing containerized testing, default to same settings as test env.
68-
# Prod settings are handled in runtime.exs if we are actually running in prod.
69-
config :phoenix_container_example, PhoenixContainerExample.Mailer, adapter: Swoosh.Adapters.Test
70-
config :swoosh, :api_client, false
71-
7273
# Configures Swoosh API Client
7374
# config :swoosh, api_client: Swoosh.ApiClient.Finch, finch_name: PhoenixContainerExample.Finch
7475

0 commit comments

Comments
 (0)