From e61b4098385eef2ee498f1a12c798f1f0e43c7fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timoth=C3=A9e=20Floure?= Date: Tue, 12 Jan 2021 10:43:59 +0100 Subject: [PATCH] Configure mix release, add release runtime configuration --- config/prod.exs | 4 ---- config/{prod.secret.exs => release-runtime.exs} | 11 +++++------ mix.exs | 10 +++++++++- 3 files changed, 14 insertions(+), 11 deletions(-) rename config/{prod.secret.exs => release-runtime.exs} (75%) diff --git a/config/prod.exs b/config/prod.exs index c4f098f..e4f779d 100644 --- a/config/prod.exs +++ b/config/prod.exs @@ -49,7 +49,3 @@ config :logger, level: :info # 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/prod.secret.exs b/config/release-runtime.exs similarity index 75% rename from config/prod.secret.exs rename to config/release-runtime.exs index 0c1847a..7c7eebb 100644 --- a/config/prod.secret.exs +++ b/config/release-runtime.exs @@ -1,8 +1,7 @@ -# 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 +import Config + +# Runtime configuration - executed early in the boot process (both for releases +# and for Mix). database_url = System.get_env("DATABASE_URL") || @@ -35,7 +34,7 @@ config :recycledcloud, RecycledCloudWeb.Endpoint, # If you are doing OTP releases, you need to instruct Phoenix # to start each relevant endpoint: # -# config :recycledcloud, RecycledCloudWeb.Endpoint, server: true +config :recycledcloud, RecycledCloudWeb.Endpoint, server: true # # Then you can assemble a release by calling `mix release`. # See `mix help release` for more information. diff --git a/mix.exs b/mix.exs index b3f6005..51b5f1f 100644 --- a/mix.exs +++ b/mix.exs @@ -10,7 +10,15 @@ defmodule RecycledCloud.MixProject do compilers: [:phoenix, :gettext] ++ Mix.compilers(), start_permanent: Mix.env() == :prod, aliases: aliases(), - deps: deps() + deps: deps(), + releases: [ + recycledcloud: [ + include_executables_for: [:unix], + applications: [runtime_tools: :permanent], + include_erts: true, + runtime_config_path: "config/release-runtime.exs" + ] + ] ] end