commit d817264

default  ·  2023-02-12 08:26:44 +0000 UTC
parent 0f4db7c
Added a user config override for 'purge_days'.
1 files changed,  +5, -4
M data.c
M data.c
+5, -4
 1@@ -184,20 +184,20 @@ int user_open(snac *snac, const char *uid)
 2                             fclose(f);
 3 
 4                             if ((snac->config_o = xs_json_loads(j)) == NULL)
 5-                                srv_log(xs_fmt("cannot parse '%s'", cfg_file_o));
 6+                                srv_log(xs_fmt("error parsing '%s'", cfg_file_o));
 7                         }
 8 
 9                         if (snac->config_o == NULL)
10                             snac->config_o = xs_dict_new();
11                     }
12                     else
13-                        srv_log(xs_fmt("cannot parse '%s'", key_file));
14+                        srv_log(xs_fmt("error parsing '%s'", key_file));
15                 }
16                 else
17                     srv_log(xs_fmt("error opening '%s' %d", key_file, errno));
18             }
19             else
20-                srv_log(xs_fmt("cannot parse '%s'", cfg_file));
21+                srv_log(xs_fmt("error parsing '%s'", cfg_file));
22         }
23         else
24             srv_debug(2, xs_fmt("error opening '%s' %d", cfg_file, errno));
25@@ -1648,7 +1648,8 @@ void purge_user(snac *snac)
26     priv_days = xs_number_get(xs_dict_get(srv_config, "timeline_purge_days"));
27     pub_days  = xs_number_get(xs_dict_get(srv_config, "local_purge_days"));
28 
29-    if ((v = xs_dict_get(snac->config, "purge_days")) != NULL)
30+    if ((v = xs_dict_get(snac->config_o, "purge_days")) != NULL ||
31+        (v = xs_dict_get(snac->config, "purge_days")) != NULL)
32         user_days = xs_number_get(v);
33 
34     if (user_days) {