better configuration, better README for releases

master
Thurloat 6 years ago
parent 906a52b3d3
commit 75ed3bad0d
  1. 8
      README.md
  2. 5
      config/config.exs
  3. 4
      config/prod.exs
  4. 19
      lib/dough.ex

@ -22,7 +22,13 @@ proxy server from sources they actually trust.
## Running the server ## Running the server
You can compile a release by running `MIX_ENV=prod mix release`. You can compile a release by running the following:
```
export REPLACE_OS_VARS=true
export MIX_ENV=prod
mix release --env=prod
```
Then to run the server, you can supply your own DNS server via the DOUGH_DNS Then to run the server, you can supply your own DNS server via the DOUGH_DNS
environment variable. environment variable.

@ -4,6 +4,7 @@ use Mix.Config
config :dough, config :dough,
# default, an opennic server. # default, an opennic server.
dns_server: "37.235.1.174" dns_server: "37.235.1.174",
current_version: Mix.Project.config()[:version]
# import_config "#{Mix.env}.exs" import_config "#{Mix.env}.exs"

@ -0,0 +1,4 @@
use Mix.Config
config :dough,
dns_server: "${DOUGH_DNS}"

@ -6,12 +6,10 @@ defmodule Dough do
import Supervisor.Spec import Supervisor.Spec
import Cachex.Spec import Cachex.Spec
import Logger
def start(_type, _args) do def start(_type, _args) do
# List all child processes to be supervised
children = [ children = [
# Starts a worker by calling: Dough.Worker.start_link(arg)
# {Dough.Worker, arg},
# Plug.Adapters.Cowboy.child_spec(:https, Dough.Router, [], port: 8331, keyfile: "priv/ssl/localhost.key", certfile: "priv/ssl/localhost.crt", otp_app: :dough)
worker(Cachex, [ worker(Cachex, [
:dough, :dough,
[ [
@ -34,8 +32,17 @@ defmodule Dough do
]} ]}
] ]
# See https://hexdocs.pm/elixir/Supervisor.html Logger.info("
# for other strategies and supported options
Starting Dough Server #{Application.get_env(:dough, :current_version)} ...
DNS Proxying to #{Application.get_env(:dough, :dns_server)}
")
opts = [strategy: :one_for_one, name: Dough.Supervisor] opts = [strategy: :one_for_one, name: Dough.Supervisor]
Supervisor.start_link(children, opts) Supervisor.start_link(children, opts)
end end

Loading…
Cancel
Save