mirror of
https://github.com/benbusby/farside.git
synced 2025-06-08 10:26:36 +00:00
do not log in prod
This commit is contained in:
parent
b73a8b4a4b
commit
876bc2136b
2 changed files with 19 additions and 8 deletions
|
@ -93,13 +93,18 @@ defmodule Farside do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
def save_results(file, data) do
|
def save_results(file, data) do
|
||||||
|
case System.get_env("MIX_ENV") do
|
||||||
|
"prod" ->
|
||||||
|
nil
|
||||||
|
|
||||||
|
_ ->
|
||||||
{:ok, file} = File.open(file, [:append])
|
{:ok, file} = File.open(file, [:append])
|
||||||
bin = :erlang.term_to_binary(data)
|
bin = :erlang.term_to_binary(data)
|
||||||
IO.binwrite(file, bin)
|
IO.binwrite(file, bin)
|
||||||
File.close(file)
|
File.close(file)
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def restore_term(file) do
|
def restore_term(file) do
|
||||||
{:ok, bin} = File.read(file)
|
{:ok, bin} = File.read(file)
|
||||||
|
|
|
@ -5,9 +5,15 @@ defmodule Farside.Instances do
|
||||||
update_file = Application.fetch_env!(:farside, :update_file)
|
update_file = Application.fetch_env!(:farside, :update_file)
|
||||||
update_json = update_file <> ".json"
|
update_json = update_file <> ".json"
|
||||||
|
|
||||||
|
case System.get_env("MIX_ENV") do
|
||||||
|
"prod" ->
|
||||||
|
nil
|
||||||
|
|
||||||
|
_ ->
|
||||||
File.rename(update_json, "#{update_file}-#{to_string(DateTime.utc_now()) <> ".json"}")
|
File.rename(update_json, "#{update_file}-#{to_string(DateTime.utc_now()) <> ".json"}")
|
||||||
|
|
||||||
File.write(update_json, "")
|
File.write(update_json, "")
|
||||||
|
end
|
||||||
|
|
||||||
LastUpdated.value(DateTime.utc_now())
|
LastUpdated.value(DateTime.utc_now())
|
||||||
Farside.Instance.Supervisor.update_children()
|
Farside.Instance.Supervisor.update_children()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue