Integrating MasteryPersistence into Mastery
Let’s learn to integrate our new mix project into Mastery, beginning with configuring Mastery to use this project repository.
Now, it’s time to finish up the integration. First, let’s think about what needs to happen for Mastery to work with our tiny external persistence project. We’ll specify the dependency and modify QuizSession.answer_question
to take an extra configurable function that will actually persist a response. Here’s our checklist:
-
Configure the project to use a repository.
-
Add a persistence function to our external API.
-
Wire that persistence function into the
Boundary.QuizSession GenServer
.
It’s going to go quickly. Let’s do the configuration first.
Configuring Mastery for persistence
The first step of our integration is adding the repository to our configuration. To us, the repository is just an external GenServer
dependency.
Adding the repository
We’ll switch over to the mastery
directory so we can work on the main body of the project. We’ll go to /config/config.exs
to add the repo, like this:
Get hands-on with 1200+ tech skills courses.