chore: Make configs consistent

This commit is contained in:
Robert Prehn 2020-09-30 15:56:22 -05:00
parent cd2379d4e7
commit d89b83c932
13 changed files with 147 additions and 547 deletions

View file

@ -1,26 +0,0 @@
# 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.
use Mix.Config
# General application configuration
config :content,
ecto_repos: [Content.Repo]
config :phoenix, :json_library, Jason
# Configures Elixir's Logger
config :logger, :console,
format: "$time $metadata[$level] $message\n",
metadata: [:user_id]
config :content, Content.Scheduler,
jobs: [
{"@hourly", {Content.Sitemaps, :generate, []}}
]
# Import environment specific config. This must remain at the bottom
# of this file so it overrides the configuration defined above.
import_config "#{Mix.env}.exs"

View file

@ -1,76 +0,0 @@
use Mix.Config
# Configure your database
config :content, Content.Repo,
username: "postgres",
password: "postgres",
database: "legendary_dev",
hostname: "localhost",
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 :content, Content.Endpoint,
http: [port: 4000],
debug_errors: true,
code_reloader: true,
check_origin: false,
watchers: [
node: [
"node_modules/webpack/bin/webpack.js",
"--mode",
"development",
"--watch-stdin",
cd: Path.expand("../assets", __DIR__)
]
]
# ## 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.
# Watch static and templates for browser reloading.
config :content, Content.Endpoint,
live_reload: [
patterns: [
~r"priv/static/.*(js|css|png|jpeg|jpg|gif|svg)$",
~r"priv/gettext/.*(po)$",
~r"lib/content_web/(live|views)/.*(ex)$",
~r"lib/content_web/templates/.*(eex)$"
]
]
# 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

View file

@ -1,4 +0,0 @@
use Mix.Config
# Print only warnings and errors during test
config :logger, level: :warn

View file

@ -38,7 +38,7 @@ defmodule Content.MarkupFieldTest do
end
test "render_form/5 makes a field with a simplemde data attribute" do
safe = render_form(nil, nil, form, :boop, %{})
safe = render_form(nil, nil, form(), :boop, %{})
assert safe_to_string(safe) =~ "data-simplemde"
end

View file

@ -1,31 +0,0 @@
# 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
use Mix.Config
config :core,
ecto_repos: [Core.Repo]
# Configures the endpoint
config :core, AppWeb.Endpoint,
url: [host: "localhost"],
secret_key_base: "kNJbLKCmuZYSK99S55+DmirA2TlmOxzs/xz3xnlXtOhQCoBMmYRabaRLTXkcsw5d",
render_errors: [view: CoreWeb.ErrorView, accepts: ~w(html json), layout: false],
pubsub_server: Core.PubSub,
live_view: [signing_salt: "Nb8V5NUr"]
# 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 "#{Mix.env()}.exs"

View file

@ -1,76 +0,0 @@
use Mix.Config
# Configure your database
config :core, Core.Repo,
username: "postgres",
password: "postgres",
database: "legendary_dev",
hostname: "localhost",
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 :core, CoreWeb.Endpoint,
# http: [port: 4000],
# debug_errors: true,
# code_reloader: true,
# check_origin: false,
# watchers: [
# node: [
# "node_modules/webpack/bin/webpack.js",
# "--mode",
# "development",
# "--watch-stdin",
# cd: Path.expand("../assets", __DIR__)
# ]
# ]
# ## 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.
# Watch static and templates for browser reloading.
config :core, CoreWeb.Endpoint,
live_reload: [
patterns: [
~r"priv/static/.*(js|css|png|jpeg|jpg|gif|svg)$",
~r"priv/gettext/.*(po)$",
~r"lib/core_web/(live|views)/.*(ex)$",
~r"lib/core_web/templates/.*(eex)$"
]
]
# 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

View file

@ -1,55 +0,0 @@
use Mix.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 :core, AppWeb.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 :core, CoreWeb.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 :core, CoreWeb.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"

View file

@ -1,41 +0,0 @@
# In this file, we load production configuration and secrets
# from environment variables. You can also hardcode secrets,
# although such is generally not recommended and you have to
# remember to add this file to your .gitignore.
use Mix.Config
database_url =
System.get_env("DATABASE_URL") ||
raise """
environment variable DATABASE_URL is missing.
For example: ecto://USER:PASS@HOST/DATABASE
"""
config :core, Core.Repo,
# ssl: true,
url: database_url,
pool_size: String.to_integer(System.get_env("POOL_SIZE") || "10")
secret_key_base =
System.get_env("SECRET_KEY_BASE") ||
raise """
environment variable SECRET_KEY_BASE is missing.
You can generate one by calling: mix phx.gen.secret
"""
config :core, AppWeb.Endpoint,
http: [
port: String.to_integer(System.get_env("PORT") || "4000"),
transport_options: [socket_opts: [:inet6]]
],
secret_key_base: secret_key_base
# ## Using releases (Elixir v1.9+)
#
# If you are doing OTP releases, you need to instruct Phoenix
# to start each relevant endpoint:
#
# config :core, CoreWeb.Endpoint, server: true
#
# Then you can assemble a release by calling `mix release`.
# See `mix help release` for more information.

View file

@ -1,22 +0,0 @@
use Mix.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 :core, Core.Repo,
username: "postgres",
password: "postgres",
database: "legendary_test#{System.get_env("MIX_TEST_PARTITION")}",
hostname: System.get_env("DATABASE_URL") || "localhost",
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 :core, AppWeb.Endpoint,
http: [port: 4002],
server: false
# Print only warnings and errors during test
config :logger, level: :warn

View file

@ -1,29 +1,5 @@
use Mix.Config
# Configures the endpoint
config :app, App.Endpoint,
url: [host: "localhost"],
secret_key_base: "TOB3UL0s6bHCiBoCnflb5GZTHlA6gvvq2BlRurVQca0WcK8Lf+b2xq/KahpWSvJs",
render_errors: [view: App.ErrorView, accepts: ~w(html json), layout: false],
pubsub_server: App.PubSub,
live_view: [signing_salt: "H9ynuZL0"]
config :admin,
ecto_repos: [Admin.Repo],
generators: [context_app: false]
config :app,
ecto_repos: [App.Repo],
generators: [context_app: :app]
# Configures the endpoint
config :admin, Admin.Endpoint,
url: [host: "localhost"],
secret_key_base: "r2eN53mJ9RmlGz9ZQ7xf43P3Or59aaO9rdf5D3hRcsuiH44pGW9kPGfl5mt9N1Gi",
render_errors: [view: Admin.ErrorView, accepts: ~w(html json), layout: false],
pubsub_server: Admin.PubSub,
live_view: [signing_salt: "g5ltUbnQ"]
# Configures the endpoint
config :app, AppWeb.Endpoint,
url: [host: "localhost"],
@ -32,24 +8,13 @@ config :app, AppWeb.Endpoint,
pubsub_server: App.PubSub,
live_view: [signing_salt: "g5ltUbnQ"]
# Configure Mix tasks and generators
config :auth,
ecto_repos: [Auth.Repo]
config :admin, Admin.Endpoint,
url: [host: "localhost"],
secret_key_base: "r2eN53mJ9RmlGz9ZQ7xf43P3Or59aaO9rdf5D3hRcsuiH44pGW9kPGfl5mt9N1Gi",
render_errors: [view: Admin.ErrorView, accepts: ~w(html json), layout: false],
pubsub_server: Admin.PubSub,
live_view: [signing_salt: "g5ltUbnQ"]
config :auth_web,
ecto_repos: [Auth.Repo],
generators: [context_app: :auth]
config :auth_web, :pow,
user: Auth.User,
repo: Auth.Repo,
extensions: [PowEmailConfirmation, PowPersistentSession, PowResetPassword],
controller_callbacks: Pow.Extension.Phoenix.ControllerCallbacks,
mailer_backend: AuthWeb.Pow.Mailer,
web_mailer_module: AuthWeb,
web_module: AuthWeb
# Configures the endpoint
config :auth_web, AuthWeb.Endpoint,
url: [host: "localhost"],
secret_key_base: "cjtU4RvTirW4yJZDkdqZJmaj7bvaQRrX6mevkoGYqzEuMujV/Q0w3utlO5+FUsUj",
@ -64,19 +29,54 @@ config :content, Content.Endpoint,
pubsub_server: Content.PubSub,
live_view: [signing_salt: "Nb8V5NUr"]
config :admin,
ecto_repos: [Admin.Repo]
config :core, email_from: "example@example.org"
config :content,
generators: [context_app: false]
config :core, CoreWeb.Endpoint,
url: [host: "localhost"],
secret_key_base: "kNJbLKCmuZYSK99S55+DmirA2TlmOxzs/xz3xnlXtOhQCoBMmYRabaRLTXkcsw5d",
render_errors: [view: CoreWeb.ErrorView, accepts: ~w(html json), layout: false],
pubsub_server: Core.PubSub,
live_view: [signing_salt: "Nb8V5NUr"]
config :content, Content.Endpoint, server: false
config :auth_web, AuthWeb.Endpoint, server: false
config :admin, Admin.Endpoint, server: false
config :app, CoreWeb.Endpoint, server: false
# Configure Mix tasks and generators
config :admin,
ecto_repos: [Admin.Repo],
generators: [context_app: false]
config :app,
ecto_repos: [App.Repo],
generators: [context_app: :app]
config :auth,
ecto_repos: [Auth.Repo]
config :auth_web,
ecto_repos: [Auth.Repo],
generators: [context_app: :auth]
config :content,
ecto_repos: [Content.Repo]
config :core,
ecto_repos: [Core.Repo]
config :auth_web, :pow,
user: Auth.User,
repo: Auth.Repo,
extensions: [PowEmailConfirmation, PowPersistentSession, PowResetPassword],
controller_callbacks: Pow.Extension.Phoenix.ControllerCallbacks,
mailer_backend: AuthWeb.Pow.Mailer,
web_mailer_module: AuthWeb,
web_module: AuthWeb
config :core, email_from: "example@example.org"
config :content,
generators: [context_app: false]
import_config "../apps/*/config/config.exs"
# Configures Elixir's Logger
@ -89,6 +89,11 @@ config :phoenix, :json_library, Jason
config :linguist, pluralization_key: :count
config :content, Content.Scheduler,
jobs: [
{"@hourly", {Content.Sitemaps, :generate, []}}
]
import_config "email_styles.exs"
import_config "admin.exs"

View file

@ -21,6 +21,51 @@ config :app, AppWeb.Endpoint,
]
]
config :admin, Admin.Endpoint,
http: [port: 4000],
debug_errors: true,
code_reloader: true,
check_origin: false,
watchers: [
node: [
"node_modules/webpack/bin/webpack.js",
"--mode",
"development",
"--watch-stdin",
cd: Path.expand("../apps/admin/assets", __DIR__)
]
]
config :auth_web, AuthWeb.Endpoint,
http: [port: 4000],
debug_errors: true,
code_reloader: true,
check_origin: false,
watchers: [
node: [
"node_modules/webpack/bin/webpack.js",
"--mode",
"development",
"--watch-stdin",
cd: Path.expand("../apps/auth_web/assets", __DIR__)
]
]
config :content, Content.Endpoint,
http: [port: 4000],
debug_errors: true,
code_reloader: true,
check_origin: false,
watchers: [
node: [
"node_modules/webpack/bin/webpack.js",
"--mode",
"development",
"--watch-stdin",
cd: Path.expand("../assets", __DIR__)
]
]
# ## SSL Support
#
# In order to use HTTPS in development, a self-signed
@ -56,24 +101,13 @@ config :app, AppWeb.Endpoint,
]
]
# 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 :admin, Admin.Endpoint,
http: [port: 4000],
debug_errors: true,
code_reloader: true,
check_origin: false,
watchers: [
node: [
"node_modules/webpack/bin/webpack.js",
"--mode",
"development",
"--watch-stdin",
cd: Path.expand("../apps/admin/assets", __DIR__)
config :content, Content.Endpoint,
live_reload: [
patterns: [
~r"priv/static/.*(js|css|png|jpeg|jpg|gif|svg)$",
~r"priv/gettext/.*(po)$",
~r"lib/content_web/(live|views)/.*(ex)$",
~r"lib/content_web/templates/.*(eex)$"
]
]
@ -139,26 +173,21 @@ config :app, App.Repo,
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 :auth_web, AuthWeb.Endpoint,
http: [port: 4000],
debug_errors: true,
code_reloader: true,
check_origin: false,
watchers: [
node: [
"node_modules/webpack/bin/webpack.js",
"--mode",
"development",
"--watch-stdin",
cd: Path.expand("../apps/auth_web/assets", __DIR__)
]
]
config :content, Content.Repo,
username: "postgres",
password: "postgres",
database: "legendary_dev",
hostname: "localhost",
show_sensitive_data_on_connection_error: true,
pool_size: 10
config :core, Core.Repo,
username: "postgres",
password: "postgres",
database: "legendary_dev",
hostname: "localhost",
show_sensitive_data_on_connection_error: true,
pool_size: 10
# ## SSL Support
#
@ -195,6 +224,16 @@ config :auth_web, AuthWeb.Endpoint,
]
]
config :core, CoreWeb.Endpoint,
live_reload: [
patterns: [
~r"priv/static/.*(js|css|png|jpeg|jpg|gif|svg)$",
~r"priv/gettext/.*(po)$",
~r"lib/core_web/(live|views)/.*(ex)$",
~r"lib/core_web/templates/.*(eex)$"
]
]
# For development, we disable any cache and enable
# debugging and code reloading.
#

View file

@ -13,147 +13,22 @@ config :app, App.Endpoint,
url: [host: "example.com", port: 80],
cache_static_manifest: "priv/static/cache_manifest.json"
# ## 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 :app, App.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 :app, App.Endpoint,
# force_ssl: [hsts: true]
#
# Check `Plug.SSL` for all available options in `force_ssl`.
# 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 :admin, Admin.Endpoint,
url: [host: "example.com", port: 80],
cache_static_manifest: "priv/static/cache_manifest.json"
# ## 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 :admin, Admin.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 :admin, Admin.Endpoint,
# force_ssl: [hsts: true]
#
# Check `Plug.SSL` for all available options in `force_ssl`.
# 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 :auth_web, AuthWeb.Endpoint,
url: [host: "example.com", port: 80],
cache_static_manifest: "priv/static/cache_manifest.json"
# ## 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 :auth_web, AuthWeb.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 :auth_web, AuthWeb.Endpoint,
# force_ssl: [hsts: true]
#
# Check `Plug.SSL` for all available options in `force_ssl`.
# 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 :content, Content.Endpoint,
url: [host: "example.com", port: 80],
cache_static_manifest: "priv/static/cache_manifest.json"
config :core, AppWeb.Endpoint,
url: [host: "example.com", port: 80],
cache_static_manifest: "priv/static/cache_manifest.json"
# ## SSL Support
#
# To get SSL working, you will need to add the `https` key

View file

@ -31,6 +31,13 @@ config :content, Content.Repo,
hostname: System.get_env("DATABASE_URL") || "localhost",
pool: Ecto.Adapters.SQL.Sandbox
config :core, Core.Repo,
username: "postgres",
password: "postgres",
database: "legendary_test#{System.get_env("MIX_TEST_PARTITION")}",
hostname: System.get_env("DATABASE_URL") || "localhost",
pool: Ecto.Adapters.SQL.Sandbox
config :admin, Admin.Repo,
username: "postgres",
password: "postgres",
@ -57,5 +64,10 @@ config :content, Content.Endpoint,
http: [port: 4002],
server: false
config :core, AppWeb.Endpoint,
http: [port: 4002],
server: false
config :core, CoreMailer, adapter: Bamboo.TestAdapter
config :logger, level: :warn