Automatically create cookie file on boot
This commit is contained in:
parent
2d1d5311b4
commit
0d9998939c
1 changed files with 9 additions and 0 deletions
|
|
@ -14,6 +14,7 @@ defmodule Pinchflat.Boot.PreJobStartupTasks do
|
|||
|
||||
alias Pinchflat.Repo
|
||||
alias Pinchflat.Settings
|
||||
alias Pinchflat.Filesystem.FilesystemHelpers
|
||||
|
||||
def start_link(opts \\ []) do
|
||||
GenServer.start_link(__MODULE__, %{}, opts)
|
||||
|
|
@ -31,6 +32,7 @@ defmodule Pinchflat.Boot.PreJobStartupTasks do
|
|||
@impl true
|
||||
def init(state) do
|
||||
reset_executing_jobs()
|
||||
create_blank_cookie_file()
|
||||
apply_default_settings()
|
||||
rename_old_job_workers()
|
||||
|
||||
|
|
@ -49,6 +51,13 @@ defmodule Pinchflat.Boot.PreJobStartupTasks do
|
|||
Logger.info("Reset #{count} executing jobs")
|
||||
end
|
||||
|
||||
defp create_blank_cookie_file do
|
||||
base_dir = Application.get_env(:pinchflat, :extras_directory)
|
||||
filepath = Path.join([base_dir, "cookies.txt"])
|
||||
|
||||
FilesystemHelpers.write_p!(filepath, "")
|
||||
end
|
||||
|
||||
defp apply_default_settings do
|
||||
Settings.fetch!(:onboarding, true)
|
||||
Settings.fetch!(:pro_enabled, false)
|
||||
|
|
|
|||
Loading…
Reference in a new issue