refactor: consolidate settings lookups and secrets loading

- Extract fetch_setting/1 in Settings (4 callsites → 1 repo lookup)
- Replace hardcoded load_stripe_config with registry-driven load_all
- Adding new secrets is now a one-line @secret_registry entry
- Mark DRY refactor plan as complete (all 8 items done)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
jamey
2026-02-08 14:42:13 +00:00
parent 3eacd91fda
commit 3b8d5faf3b
5 changed files with 39 additions and 33 deletions

View File

@@ -36,13 +36,13 @@ defmodule SimpleshopTheme.Stripe.Setup do
case maybe_create_webhook(api_key) do
{:ok, result} ->
Secrets.load_stripe_config()
Secrets.load_all()
{:ok, result}
{:error, reason} ->
# Key is valid and stored, but webhook creation failed.
# Still load the key so checkout works (webhooks can be set up manually).
Secrets.load_stripe_config()
Secrets.load_all()
{:error, reason}
end
end
@@ -68,7 +68,7 @@ defmodule SimpleshopTheme.Stripe.Setup do
"""
def save_signing_secret(signing_secret) do
Settings.put_secret("stripe_signing_secret", signing_secret)
Secrets.load_stripe_config()
Secrets.load_all()
end
@doc """