From f0c518c3c94e05bb1dda52d91fb19c5272e140cd Mon Sep 17 00:00:00 2001 From: Thurloat Date: Tue, 11 Sep 2018 10:49:04 -0300 Subject: [PATCH] move config to a file, update readme with compile/run instructions --- README.md | 20 +++++++++++--------- config/dev.exs | 1 + config/prod.exs | 4 ++-- mix.exs | 3 ++- mix.lock | 1 + rel/config.exs | 6 ++++++ rel/config/dough.toml | 2 ++ 7 files changed, 25 insertions(+), 12 deletions(-) create mode 100644 config/dev.exs create mode 100644 rel/config/dough.toml diff --git a/README.md b/README.md index 133d0e2..e16f486 100644 --- a/README.md +++ b/README.md @@ -22,20 +22,22 @@ proxy server from sources they actually trust. ## Running the server -You can compile a release by running the following: +You can compile and run a release by executing the following. ``` -export REPLACE_OS_VARS=true -export MIX_ENV=prod -mix release --env=prod -``` +$ mix deps.get -Then to run the server, you can supply your own DNS server via the DOUGH_DNS -environment variable. +$ MIX_ENV=prod mix release --env=prod +$ cp _build/prod/rel/dough/etc/dough.toml ~/.config + +$ _build/prod/rel/dough/bin/dough foreground ``` -DOUGH_DNS="1.1.1.1" _build/prod/rel/dough/bin/dough foreground -``` + +Feel free to edit the config file at `~/.config/dough.toml` to configure it to +use your favourite DNS provider as the proxy. By default, it's configured to +use [OpenNIC](https://www.opennic.org/) DNS servers for maximum freedom (as in +birds). ## Configure Firefox diff --git a/config/dev.exs b/config/dev.exs new file mode 100644 index 0000000..d2d855e --- /dev/null +++ b/config/dev.exs @@ -0,0 +1 @@ +use Mix.Config diff --git a/config/prod.exs b/config/prod.exs index 7a7d103..e1c948f 100644 --- a/config/prod.exs +++ b/config/prod.exs @@ -1,4 +1,4 @@ use Mix.Config -config :dough, - dns_server: "${DOUGH_DNS}" +#config :dough, +# dns_server: "${DOUGH_DNS}" diff --git a/mix.exs b/mix.exs index a57261f..3b35bfc 100644 --- a/mix.exs +++ b/mix.exs @@ -26,7 +26,8 @@ defmodule Dough.MixProject do {:plug, "~> 1.5"}, {:dns, "~> 2.1.0"}, {:cachex, "~> 3.0.3"}, - {:distillery, "~> 2.0"} + {:distillery, "~> 2.0"}, + {:toml, "~> 0.3.0"} ] end end diff --git a/mix.lock b/mix.lock index 227f24c..538fc15 100644 --- a/mix.lock +++ b/mix.lock @@ -10,5 +10,6 @@ "plug": {:hex, :plug, "1.6.2", "e06a7bd2bb6de5145da0dd950070110dce88045351224bd98e84edfdaaf5ffee", [:mix], [{:cowboy, "~> 1.0.1 or ~> 1.1 or ~> 2.4", [hex: :cowboy, repo: "hexpm", optional: true]}, {:mime, "~> 1.0", [hex: :mime, repo: "hexpm", optional: false]}], "hexpm"}, "ranch": {:hex, :ranch, "1.5.0", "f04166f456790fee2ac1aa05a02745cc75783c2bfb26d39faf6aefc9a3d3a58a", [:rebar3], [], "hexpm"}, "socket": {:hex, :socket, "0.3.13", "98a2ab20ce17f95fb512c5cadddba32b57273e0d2dba2d2e5f976c5969d0c632", [:mix], [], "hexpm"}, + "toml": {:hex, :toml, "0.3.0", "069ca29f5458cb209c84b8839bf533304904d07eadcb90b6dd4dd4517772e458", [:mix], [], "hexpm"}, "unsafe": {:hex, :unsafe, "1.0.0", "7c21742cd05380c7875546b023481d3a26f52df8e5dfedcb9f958f322baae305", [:mix], [], "hexpm"}, } diff --git a/rel/config.exs b/rel/config.exs index 220175f..168c2b1 100644 --- a/rel/config.exs +++ b/rel/config.exs @@ -47,6 +47,12 @@ end release :dough do set version: current_version(:dough) + set config_providers: [ + {Toml.Provider, [path: "${HOME}/.config/dough.toml"]} + ] + set overlays: [ + {:copy, "rel/config/dough.toml", "etc/dough.toml"} + ] set applications: [ :runtime_tools, :socket ] diff --git a/rel/config/dough.toml b/rel/config/dough.toml new file mode 100644 index 0000000..234ae4e --- /dev/null +++ b/rel/config/dough.toml @@ -0,0 +1,2 @@ +[dough] +dns_server = "37.235.1.174"