Skip to content

Instantly share code, notes, and snippets.

@RadekMolenda
Created February 21, 2016 21:44
Show Gist options
  • Save RadekMolenda/2e8a095425182b74afc5 to your computer and use it in GitHub Desktop.
Save RadekMolenda/2e8a095425182b74afc5 to your computer and use it in GitHub Desktop.
diff --git a/config/config.exs b/config/config.exs
index 9346d58..36340d7 100644
--- a/config/config.exs
+++ b/config/config.exs
@@ -3,6 +3,9 @@
use Mix.Config
config :hound, driver: "phantomjs"
+config :swarmsimulatorbot, swarm_url: "https://swarmsim.github.io"
+config :swarmsimulatorbot, save_file: "save/save.dat"
+config :swarmsimulatorbot, tick: 1_000
# This configuration is loaded before any dependency and is restricted
# to this project. If another project depends on this project, this
# file won't be loaded nor affect the parent project. For this reason,
diff --git a/lib/swarmsimulatorbot.ex b/lib/swarmsimulatorbot.ex
index 8499dde..6b9474f 100644
--- a/lib/swarmsimulatorbot.ex
+++ b/lib/swarmsimulatorbot.ex
@@ -2,8 +2,8 @@ defmodule Swarmsimulatorbot do
use Hound.Helpers
use GenServer
- @swarm_url "https://swarmsim.github.io"
- @save_file "save/save.dat"
+ @swarm_url Application.get_env(:swarmsimulatorbot, :swarm_url)
+ @save_file Application.get_env(:swarmsimulatorbot, :save_file)
def start_link do
GenServer.start_link(__MODULE__, nil, name: __MODULE__)
diff --git a/lib/swarmsimulatorbot/cli.ex b/lib/swarmsimulatorbot/cli.ex
index f76267a..f075499 100644
--- a/lib/swarmsimulatorbot/cli.ex
+++ b/lib/swarmsimulatorbot/cli.ex
@@ -1,5 +1,5 @@
defmodule Swarmsimulatorbot.Cli do
- @tick 10000
+ @tick Application.get_env(:swarmsimulatorbot, :tick)
use GenServer
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment