Add server init logic for SAML and DNS #283
Merged
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.
Fixes #275.
We have a number of modules that require some kind of asynchronous setup step before the app can start. Currently, this includes:
IdentityProvider
instanceIn order to facility this kind of logic, I'm adding a step before the server is started that does any
init()
that a module might need done. All you have to do isexport
anasync
function, and we'll call it at startup.The way that Remix hot-reloads work, I had to do a bit of gymnastics to preserve module state after a server-side reload. The current
db.server.ts
file shows a pattern to use: define aglobal
variable and stick the instance data there, then restore it when the module is reloaded.I've also moved the SAML code into
app/lib/
like the other server modules.To test this, do
npm run build
andnpm run dev
and you'll see something like this:Now the metadata is downloaded (SAML login should work) and a DNS hosted zone has been created (the DNS stuff in #274 should work in development).