Remove remnants of non-global LogConfig from TelodendriaConfig

This commit is contained in:
Jordan Bancino 2023-03-22 16:31:24 +00:00
parent e6f3dfad18
commit e30fa3ee33
4 changed files with 15 additions and 14 deletions

View file

@ -38,20 +38,21 @@ Milestone: v0.3.0
[x] Global log object [x] Global log object
- So we don't have to pass LogConfig around everywhere - So we don't have to pass LogConfig around everywhere
- Also allows debug and error logging in other APIs - Also allows debug and error logging in other APIs
[ ] Proper HTTP request router [ ] Make 'listen' directive in config an array of objects
- Support regex matching - Each object has port, threads, maxConnections
- If tls is given, it can be null, false, or an object with cert and key
[ ] Pass TLS certs and keys into HttpServer
[ ] Move configuration to database [ ] Move configuration to database
[ ] Initial configuration [ ] Initial configuration
[ ] If no config, create one-time use registration token that [ ] If no config, create one-time use registration token that
grants user admin privileges. grants user admin privileges.
[ ] /_telodendria/admin/config endpoint [ ] /_telodendria/admin/config endpoint
[ ] Refactor TelodendriaConfig to just Config (ConfigLock() and ConfigUnlock()) [ ] Refactor TelodendriaConfig to just Config (ConfigLock() and ConfigUnlock())
[ ] Make 'listen' directive in config an array of objects [ ] Proper HTTP request router
- Each object has port, threads, maxConnections - Support regex matching
- If tls is given, it can be null, false, or an object with cert and key
[ ] Pass TLS certs and keys into HttpServer
[ ] Documentation [ ] Documentation
[ ] Array
[ ] Io [ ] Io
[ ] Stream [ ] Stream
[ ] Tls [ ] Tls

View file

@ -168,7 +168,7 @@ main(int argc, char **argv)
goto finish; goto finish;
} }
tConfig = TelodendriaConfigParse(config, LogConfigGlobal()); tConfig = TelodendriaConfigParse(config);
JsonFree(config); JsonFree(config);
if (!tConfig) if (!tConfig)

View file

@ -90,7 +90,7 @@
} }
int int
ConfigParseRunAs(LogConfig * lc, TelodendriaConfig * tConfig, HashMap * config) ConfigParseRunAs(TelodendriaConfig * tConfig, HashMap * config)
{ {
JsonValue *value; JsonValue *value;
@ -106,7 +106,7 @@ error:
} }
int int
ConfigParseLog(LogConfig * lc, TelodendriaConfig * tConfig, HashMap * config) ConfigParseLog(TelodendriaConfig * tConfig, HashMap * config)
{ {
JsonValue *value; JsonValue *value;
char *str; char *str;
@ -192,12 +192,12 @@ error:
} }
TelodendriaConfig * TelodendriaConfig *
TelodendriaConfigParse(HashMap * config, LogConfig * lc) TelodendriaConfigParse(HashMap * config)
{ {
TelodendriaConfig *tConfig; TelodendriaConfig *tConfig;
JsonValue *value; JsonValue *value;
if (!config || !lc) if (!config)
{ {
return NULL; return NULL;
} }
@ -240,7 +240,7 @@ TelodendriaConfigParse(HashMap * config, LogConfig * lc)
{ {
if (JsonValueType(value) == JSON_OBJECT) if (JsonValueType(value) == JSON_OBJECT)
{ {
if (!ConfigParseRunAs(lc, tConfig, JsonValueAsObject(value))) if (!ConfigParseRunAs(tConfig, JsonValueAsObject(value)))
{ {
goto error; goto error;
} }
@ -273,7 +273,7 @@ TelodendriaConfigParse(HashMap * config, LogConfig * lc)
} }
CONFIG_REQUIRE("log", JSON_OBJECT); CONFIG_REQUIRE("log", JSON_OBJECT);
if (!ConfigParseLog(lc, tConfig, JsonValueAsObject(value))) if (!ConfigParseLog(tConfig, JsonValueAsObject(value)))
{ {
goto error; goto error;
} }

View file

@ -60,7 +60,7 @@ typedef struct TelodendriaConfig
} TelodendriaConfig; } TelodendriaConfig;
extern TelodendriaConfig * extern TelodendriaConfig *
TelodendriaConfigParse(HashMap *, LogConfig *); TelodendriaConfigParse(HashMap *);
extern void extern void
TelodendriaConfigFree(TelodendriaConfig *); TelodendriaConfigFree(TelodendriaConfig *);