Hi. I want to add a function to Release.ex file in order to register a new user in production. Currently I have generated phoenix Authentication codes. In Accounts.ex file there is a register_user function like this:
def register_user(attrs) do
%User{}
|> User.registration_changeset(attrs)
|> Repo.insert()
end
I created a new function in Release.ex file and used the above function from Accounts module to define a create_user custom command:
def create_user(email, password) do
load_app()
%{"email" => email, "password" => password}
|> Accounts.register_user()
end
Then I ran the create_user command using eval:
bin/my_app eval "MyApp.Release.create_user('some_email', 'some password')"
But I get this error:
...
(RuntimeError) could not lookup Ecto repo MyApp.Repo because it was not started or it does not exist.
Could you please tell me what is going wrong?