diff options
Diffstat (limited to 'ereproxy_config.erl')
-rw-r--r-- | ereproxy_config.erl | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/ereproxy_config.erl b/ereproxy_config.erl new file mode 100644 index 0000000..37423e4 --- /dev/null +++ b/ereproxy_config.erl @@ -0,0 +1,31 @@ +-module(ereproxy_config). +-export([config/0, select_destination/1]). + +-include("ereproxy_config.hrl"). + +config() -> + #cfg{listen = [{http, 80}, {https, 443}], + ssl_opts = [{certfile, "example/cert.pem"}, + {keyfile, "example/key.pem"}] + }. + +%% select_destination +select_destination(HostName) -> + case lists:keysearch(HostName, 1, destination_list()) of + {value, {HostName, Destination}} -> Destination; + _UnknownHostName -> destination_default() + end. + +destination_default() -> + {"192.168.130.35", 80}. + +destination_list() -> + [ + {"code.sotun.de", {"192.168.130.103", 80}}, + {"wave.sotun.de", {"192.168.130.111", 9898}} + | [{WWW ++ "kraut" ++ Dash ++ "computing." ++ TLD, + {"192.168.130.37", 80}} + || WWW <- ["", "www."], + Dash <- ["", "-"], + TLD <- ["com", "de", "net", "eu", "org", "at"] ] + ]. |