mirror of
https://github.com/benbusby/farside.git
synced 2025-06-08 10:26:36 +00:00
run as local service
This commit is contained in:
parent
876bc2136b
commit
e9cca35a54
10 changed files with 111 additions and 22 deletions
|
@ -94,15 +94,11 @@ defmodule Farside do
|
|||
end
|
||||
|
||||
def save_results(file, data) do
|
||||
case System.get_env("MIX_ENV") do
|
||||
"prod" ->
|
||||
nil
|
||||
|
||||
_ ->
|
||||
{:ok, file} = File.open(file, [:append])
|
||||
bin = :erlang.term_to_binary(data)
|
||||
IO.binwrite(file, bin)
|
||||
File.close(file)
|
||||
if System.get_env("MIX_ENV") == "dev" do
|
||||
{:ok, file} = File.open(file, [:append])
|
||||
bin = :erlang.term_to_binary(data)
|
||||
IO.binwrite(file, bin)
|
||||
File.close(file)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -5,14 +5,10 @@ defmodule Farside.Instances do
|
|||
update_file = Application.fetch_env!(:farside, :update_file)
|
||||
update_json = update_file <> ".json"
|
||||
|
||||
case System.get_env("MIX_ENV") do
|
||||
"prod" ->
|
||||
nil
|
||||
if System.get_env("MIX_ENV") == "dev" do
|
||||
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())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue