fix: runtime.exs OPS_SECRET_KEY_BASE optional, release.ex handles missing ecto_repos

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
Mikael Hugo 2026-05-09 20:49:09 +02:00
parent 9e0b43ea90
commit 29e4f25e15
2 changed files with 7 additions and 5 deletions

View file

@ -13,7 +13,7 @@ defmodule CentralcloudMy.Release do
{:ok, _, _} = Ecto.Migrator.with_repo(repo, &Ecto.Migrator.run(&1, :down, to: version)) {:ok, _, _} = Ecto.Migrator.with_repo(repo, &Ecto.Migrator.run(&1, :down, to: version))
end end
defp repos, do: Application.fetch_env!(@app, :ecto_repos) defp repos, do: Application.get_env(@app, :ecto_repos, [])
defp load_app do defp load_app do
Application.ensure_all_started(:ssl) Application.ensure_all_started(:ssl)

View file

@ -1,12 +1,14 @@
import Config import Config
# Runtime secrets — all required in production, optional in dev (defaults used) # Runtime secrets — each release only requires its own secret key
if config_env() == :prod do if config_env() == :prod do
config :centralcloud_my, CentralcloudMy.Endpoint, config :centralcloud_my, CentralcloudMy.Endpoint,
secret_key_base: System.fetch_env!("MY_SECRET_KEY_BASE") secret_key_base: System.get_env("MY_SECRET_KEY_BASE") || System.fetch_env!("MY_SECRET_KEY_BASE")
config :centralcloud_ops, CentralcloudOps.Endpoint, # OPS_SECRET_KEY_BASE only required when running the centralcloud_ops release
secret_key_base: System.fetch_env!("OPS_SECRET_KEY_BASE") if ops_key = System.get_env("OPS_SECRET_KEY_BASE") do
config :centralcloud_ops, CentralcloudOps.Endpoint, secret_key_base: ops_key
end
end end
config :centralcloud_core, :hostbill, config :centralcloud_core, :hostbill,