invoices: payout addresses in the database
Default crypto payout addresses lived in the CRYPTO_ADDRESSES and LTC_ADDRESS Forgejo secrets, so changing one meant editing a secret and redeploying. Keep them in a payout_addresses table edited at /admin/invoices/payout-addresses (read to view, write to change, every change audited), and prefill the new-invoice form from it. The old env values are imported once on the first boot with an empty table, so the current addresses carry over; after that the secrets can be removed. Assisted-by: Claude:opus-5
This commit is contained in:
parent
eeac07ed34
commit
1dd8f9081f
10 changed files with 179 additions and 14 deletions
|
|
@ -47,9 +47,11 @@ module CryptoAsset
|
|||
end
|
||||
|
||||
# Default payout addresses for the new-invoice form. CRYPTO_ADDRESSES is a
|
||||
# JSON object (code => address); the legacy LTC_ADDRESS env still fills LTC.
|
||||
# Unknown codes are dropped so a typo in the env can't invent an asset.
|
||||
def default_addresses
|
||||
# Legacy source, now only used to seed the payout_addresses table once
|
||||
# (PayoutAddress.seed_from_env!): CRYPTO_ADDRESSES is a JSON object
|
||||
# (code => address); LTC_ADDRESS still fills LTC. Unknown codes are
|
||||
# dropped so a typo in the env can't invent an asset.
|
||||
def env_addresses
|
||||
map = begin
|
||||
JSON.parse(ENV['CRYPTO_ADDRESSES'].to_s)
|
||||
rescue JSON::ParserError
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue