defmodule Postland do @moduledoc """ Postland keeps the contexts that define your domain and business logic. Contexts are also responsible for managing your data, regardless if it comes from the database, an external API or others. """ alias Postland.Accounts def temporary_password() do :crypto.strong_rand_bytes(12) |> Base.encode64() end def on_boot_setup() do if !setup?() do attrs = %{ username: "welcome", password: temporary_password() } {:ok, _user} = Accounts.register_user(attrs) IO.puts( "Your temporary username is #{attrs.username} and your temporary password is #{attrs.password}" ) end end def setup?() do Accounts.solo_user() != nil end end