Feat/site credentials - #311
Open
Samuelfaure wants to merge 11 commits into
Open
Conversation
New AdminApientreprise.credentials reads config/credentials.yml or config/credentials/<env>.yml, provisioned by very_ansible instead of Rails encrypted credentials committed to this repo. Falls back to generated values in dev/test/staging when a key is missing, raises in production/sandbox. secret_key_base is now set explicitly from this source, so config.require_master_key is no longer needed in production/sandbox/staging. Individual call sites are migrated to the new accessor in follow-up commits; Rails.application.credentials keeps working in the meantime.
HASH_ALGO is memoized at class-load time, so the generic string fallback
("jwt_hash_algo") isn't a valid JWT algorithm and breaks encode/decode in
dev/test. Override it to a real algorithm globally in
test_credentials_setup.rb, applied before AccessToken is first referenced.
Covers the Mailjet gem config initializer, the contact-list webhook interactor, and the shared "datapass webhook organizer" example (which previously relied on Rails' bang credential accessor via public_send).
…ew source
formulaire_qf is a nested hash ({host:, secret:}), which the generic
default_proc fallback can't represent (it only synthesizes scalars), so
add a dedicated spec that stubs it explicitly via stub_credential and
exercises FormulaireQFAPIClient's real HTTP calls end to end.
api_particulier_reporters is genuinely optional (not every group needs to be configured), so these three call sites use .fetch(key, default) rather than plain [] access, bypassing the credentials default_proc entirely instead of raising in production when the key is absent.
admin_emails (User#admin?), matomo_site_id_* (falls back to nil rather than raising, since not every namespace is tracked), sentry_dsn, ProConnect client config, and the workers UI basic-auth credentials.
Samuelfaure
marked this pull request as ready for review
July 31, 2026 08:45
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
a merger après deploy de https://github.com/etalab/very_ansible/pull/830