Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion apps/aecore/config/dev.exs
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,14 @@ use Mix.Config
# Configuration from the imported file will override the ones defined
# here (which is why it is important to import them last).
#

persistence_path = case System.get_env("PERSISTENCE_PATH") do
nil -> "apps/aecore/priv/persistence_table"
env -> env
end

config :aecore, :persistence,
table: Path.absname("apps/aecore/priv/persistence_table")
table: Path.absname(persistence_path)

config :aecore, :pow,
nif_path: Path.absname("apps/aecore/priv/aec_pow_cuckoo20_nif"),
Expand Down
9 changes: 9 additions & 0 deletions apps/aecore/config/prod.exs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,15 @@ use Mix.Config
# Configuration from the imported file will override the ones defined
# here (which is why it is important to import them last).
#

persistence_path = case System.get_env("PERSISTENCE_PATH") do
nil -> "apps/aecore/priv/persistence_table"
env -> env
end

config :aecore, :persistence,
table: Path.absname(persistence_path)

config :aecore, :pow,
nif_path: Path.absname("apps/aecore/priv/aec_pow_cuckoo26_nif"),
genesis_header: %{
Expand Down
8 changes: 8 additions & 0 deletions apps/aecore/config/test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,14 @@ use Mix.Config
# here (which is why it is important to import them last).
#

persistence_path = case System.get_env("PERSISTENCE_PATH") do
nil -> "apps/aecore/priv/persistence_table"
env -> env
end

config :aecore, :persistence,
table: Path.absname(persistence_path)

config :aecore, :pow,
nif_path: Path.absname("apps/aecore/priv/aec_pow_cuckoo20_nif"),
genesis_header: %{
Expand Down
8 changes: 5 additions & 3 deletions apps/aecore/lib/aecore/persistence/worker.ex
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ defmodule Aecore.Persistence.Worker do
@moduledoc """
Store/Restore latest blockchain and chainstate
"""

@persistence_table Application.get_env(:aecore, :persistence)[:table]

@blockchain_key :block_chain_state_key

use GenServer
Expand Down Expand Up @@ -49,7 +48,7 @@ defmodule Aecore.Persistence.Worker do
## Internal functions

defp setup do
{:ok, table} = :dets.open_file(@persistence_table , [type: :set])
{:ok, table} = :dets.open_file(persistance_table_path(), [type: :set])
%{table: table}
end

Expand All @@ -61,4 +60,7 @@ defmodule Aecore.Persistence.Worker do
end
end

defp persistance_table_path() do
Application.get_env(:aecore, :persistence)[:table]
end
end
8 changes: 7 additions & 1 deletion apps/aehttpserver/config/dev.exs
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,14 @@ use Mix.Config
# If desired, both `http:` and `https:` keys can be
# configured to run both http and https servers on
# different ports.

port = case System.get_env("PORT") do
nil -> 4000
env -> env
end

config :aehttpserver, Aehttpserver.Endpoint,
http: [port: 4000],
http: [port: port],
debug_errors: true,
code_reloader: true,
check_origin: false,
Expand Down