aboutsummaryrefslogtreecommitdiff
path: root/src/ldapsp_config.erl
diff options
context:
space:
mode:
authorGuido Günther <agx@sigxcpu.org>2016-08-21 17:34:00 +0200
committerGuido Günther <agx@sigxcpu.org>2016-11-07 19:49:55 +0100
commit3b5f2a40a4d57934825896ba31a1d929ebf02603 (patch)
treed075f730ee69d82f3fa2a0f9c914ff2753330554 /src/ldapsp_config.erl
Initial commit
Diffstat (limited to 'src/ldapsp_config.erl')
-rw-r--r--src/ldapsp_config.erl39
1 files changed, 39 insertions, 0 deletions
diff --git a/src/ldapsp_config.erl b/src/ldapsp_config.erl
new file mode 100644
index 0000000..73d15bd
--- /dev/null
+++ b/src/ldapsp_config.erl
@@ -0,0 +1,39 @@
+-module(ldapsp_config).
+
+-export([
+ dispatch/0,
+ web_config/0,
+ ldap_config/0,
+ policy_config/0
+]).
+
+
+-spec dispatch() -> [webmachine_dispatcher:route()].
+dispatch() ->
+ Resources = [ldapsp_features,
+ ldapsp_realm,
+ ldapsp_realm_hostname
+ ],
+ lists:flatten([Module:routes() || Module <- Resources]).
+
+web_config() ->
+ {ok, App} = application:get_application(?MODULE),
+ {ok, Ip} = application:get_env(App, web_ip),
+ {ok, Port} = application:get_env(App, web_port),
+ [
+ {ip, Ip},
+ {port, Port},
+ {log_dir, "priv/log"},
+ {dispatch, dispatch()}
+ ].
+
+ldap_config() ->
+ {ok, Config } = file:consult("priv/ldapsp.conf"),
+ Con = proplists:get_value(connection, Config),
+ [{server, proplists:get_value(server, Con)},
+ {user, proplists:get_value(user, Con)},
+ {password, proplists:get_value(password, Con)}].
+
+policy_config() ->
+ {ok, _Module} = compile:file("priv/policy.erl").
+