Fix use of withFallback
introduced when dropping Play 2.7
#451
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.
This fixes #449, the problem with server startup that was introduced by dropping Play 2.7 support in PR #446 and released with play-secret-rotation v8.1.0.
Dropping Play 2.7 support meant that we could use the
Configuration.withFallback()
method introduced with Play 2.8 and playframework/playframework#9674, rather than the deprecated++
method. However (as the documentation does say), the++
andwithFallback()
methods override in opposite directions -withFallback()
means that the firstConfiguration
is tried first, and the second config is tried second - which is opposite to how++
works.I missed this, and so, in PR #446, failed to reverse the order of the arguments. This meant that when
play-secret-rotation
was actually in a Play server running in Production mode, the code would attempt to evaluate theplay.http.secret.key
key insuper.configuration
(and blow up with an integrity test error), rather than get the trash value back thatConfiguration("play.http.secret.key" -> nonRotatingSecretOnlyUsedToSatisfyConfigChecks)
supplied - only To Satisfy Config Checks.Reversing the order of the arguments makes the hack work as intended, and the server can start up again 👍 ✨
It would be lovely to avoid such hackage, but that will require a resolution for playframework/playframework#12520!
Testing
This has been tried out with https://github.com/guardian/ophan/pull/6005, which demonstrated that the change fixes the problem.