| commit 31: | 4e6cf7a054b5 |
| parent 30: | 7321f010f9b6 |
| branch: | default |
Setup innostore to auto-create log and data dirs if they don't already exist
dizzyd
5 months ago
5 months ago
Changed (Δ627 bytes):
raw changeset »
ebin/innostore.app (4 lines added, 1 lines removed)
src/innostore.erl (15 lines added, 1 lines removed)
Up to file-list ebin/innostore.app:
12 |
12 |
crypto |
13 |
13 |
]}, |
14 |
14 |
{registered, []}, |
15 |
{env, [ |
|
15 |
{env, [ |
|
16 |
{log_group_home_dir, "."}, |
|
17 |
{data_home_dir, "."} |
|
18 |
]} |
|
16 |
19 |
]}. |
17 |
20 |
Up to file-list src/innostore.erl:
| … | … | @@ -240,7 +240,13 @@ set_config([{Key, Value} | Rest], Port) |
240 |
240 |
erlang:port_control(Port, ?CMD_SET_CFG, <<KBin/binary, 0:8, VBin/binary>>), |
241 |
241 |
receive |
242 |
242 |
innostore_ok -> |
243 |
|
|
243 |
case on_set_config(Key, Value) of |
|
244 |
ok -> |
|
245 |
ok; |
|
246 |
{error, Reason} -> |
|
247 |
error_logger:error_msg("Failed to post-process value for ~p = ~p: ~p\n", |
|
248 |
[Key, Value, Reason]) |
|
249 |
end; |
|
244 |
250 |
{innostore_error, Reason} -> |
245 |
251 |
error_logger:error_msg("Failed to set value for ~p = ~p: ~p\n", [Key, Value, Reason]) |
246 |
252 |
end; |
| … | … | @@ -253,6 +259,14 @@ set_config([Other | Rest], Port) -> |
253 |
259 |
[Other]), |
254 |
260 |
set_config(Rest, Port). |
255 |
261 |
|
262 |
%% |
|
263 |
%% Post process values set in the config |
|
264 |
%% |
|
265 |
on_set_config(Key, Dir) when Key == log_group_home_dir; Key == data_home_dir -> |
|
266 |
filelib:ensure_dir(filename:join(Dir, "foo")); |
|
267 |
on_set_config(_Key, _Value) -> |
|
268 |
ok. |
|
269 |
||
256 |
270 |
|
257 |
271 |
list_keystores_loop(Acc) -> |
258 |
272 |
receive |
