aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/lib
diff options
context:
space:
mode:
authorDavid M. Syzdek <david@syzdek.net>2022-03-17 16:31:01 -0800
committerDavid M. Syzdek <david@syzdek.net>2022-03-17 16:33:56 -0800
commitb16b3640778317501d5f2ed6895de1b996ee0899 (patch)
tree2435e2f52452011802dc88f9a852564736c663b4 /lib
parentec3882a29c652409bd7ffa4c3c660d6fa378512a (diff)
downloadtinyrad-b16b3640778317501d5f2ed6895de1b996ee0899.tar.gz
tinyrad-b16b3640778317501d5f2ed6895de1b996ee0899.tar.bz2
tinyrad-b16b3640778317501d5f2ed6895de1b996ee0899.tar.xz
tinyrad-b16b3640778317501d5f2ed6895de1b996ee0899.zip
libtinyrad: adding tinyrad_conf_environment()
Diffstat (limited to 'lib')
-rw-r--r--lib/libtinyrad/lconf.c41
1 files changed, 41 insertions, 0 deletions
diff --git a/lib/libtinyrad/lconf.c b/lib/libtinyrad/lconf.c
index 799460b..74cad09 100644
--- a/lib/libtinyrad/lconf.c
+++ b/lib/libtinyrad/lconf.c
@@ -73,6 +73,12 @@
73#pragma mark - Prototypes 73#pragma mark - Prototypes
74 74
75int 75int
76tinyrad_conf_environment(
77 TinyRad * tr,
78 TinyRadDict * dict );
79
80
81int
76tinyrad_conf_file( 82tinyrad_conf_file(
77 TinyRad * tr, 83 TinyRad * tr,
78 TinyRadDict * dict, 84 TinyRadDict * dict,
@@ -132,6 +138,9 @@ tinyrad_conf(
132 if ( ((opts & TRAD_NOINIT)) || ((getenv("TINYRADNOINIT"))) ) 138 if ( ((opts & TRAD_NOINIT)) || ((getenv("TINYRADNOINIT"))) )
133 return(TRAD_SUCCESS); 139 return(TRAD_SUCCESS);
134 140
141 // process environment variables
142 tinyrad_conf_environment(tr, dict);
143
135 // determine TINYRADRC suffix 144 // determine TINYRADRC suffix
136 if ((suffix = getenv("TINYRADRC")) == NULL) 145 if ((suffix = getenv("TINYRADRC")) == NULL)
137 suffix = "tinyradrc"; 146 suffix = "tinyradrc";
@@ -174,6 +183,38 @@ tinyrad_conf(
174 183
175 184
176int 185int
186tinyrad_conf_environment(
187 TinyRad * tr,
188 TinyRadDict * dict )
189{
190 char * value;
191
192 if ((value = getenv("TINYRAD_BIND_ADDRESS")) != NULL)
193 tinyrad_conf_opt(tr, dict, "bind_address", value);
194
195 if ((value = getenv("TINYRAD_BUILTIN_DICTIONARY")) != NULL)
196 tinyrad_conf_opt(tr, dict, "builtin_dictionary", value);
197
198 if ((value = getenv("TINYRAD_DICTIONARY")) != NULL)
199 tinyrad_conf_opt(tr, dict, "dictionary", value);
200
201 if ((value = getenv("TINYRAD_NETWORK_TIMEOUT")) != NULL)
202 tinyrad_conf_opt(tr, dict, "network_timeout", value);
203
204 if ((value = getenv("TINYRAD_PATHS")) != NULL)
205 tinyrad_conf_opt(tr, dict, "paths", value);
206
207 if ((value = getenv("TINYRAD_TIMEOUT")) != NULL)
208 tinyrad_conf_opt(tr, dict, "timeout", value);
209
210 if ((value = getenv("TINYRAD_URI")) != NULL)
211 tinyrad_conf_opt(tr, dict, "uri", value);
212
213 return(TRAD_SUCCESS);
214}
215
216
217int
177tinyrad_conf_file( 218tinyrad_conf_file(
178 TinyRad * tr, 219 TinyRad * tr,
179 TinyRadDict * dict, 220 TinyRadDict * dict,