Compare commits

...

2 commits

Author SHA1 Message Date
lda
a089224630
[META/MOD] Modify changelog and config page. 2024-01-05 01:04:17 +01:00
lda
d53b493754
[ADD] Add PID option 2024-01-05 01:01:16 +01:00
4 changed files with 31 additions and 0 deletions

View file

@ -75,6 +75,7 @@
"serverName": { "type": "string", "required": true }, "serverName": { "type": "string", "required": true },
"baseUrl": { "type": "string", "required": false }, "baseUrl": { "type": "string", "required": false },
"identityServer": { "type": "string", "required": false }, "identityServer": { "type": "string", "required": false },
"pid": { "type": "string", "required": false },
"maxCache": { "type": "integer", "required": false }, "maxCache": { "type": "integer", "required": false },

View file

@ -31,6 +31,7 @@ The following endpoints were added:
### Bug Fixes & General Improvements ### Bug Fixes & General Improvements
- Use `j2s` for parsing the configuration
- Fixed a double-free in `RouteUserProfile()` that would cause errors - Fixed a double-free in `RouteUserProfile()` that would cause errors
with certain Matrix clients. (#35) with certain Matrix clients. (#35)
- Improved compatibility with NetBSD on various platforms. - Improved compatibility with NetBSD on various platforms.
@ -43,6 +44,8 @@ parsing request bodies.
### New Features ### New Features
- Implemented a `"pid"` option in the configuration, allowing Telodendria
to write its process ID to a specified file.
- Moved all administrator API endpoints to `/_telodendria/admin/v1`, - Moved all administrator API endpoints to `/_telodendria/admin/v1`,
because later revisions of the administrator API may break clients, so because later revisions of the administrator API may break clients, so
we want a way to give those breaking revisions new endpoints. we want a way to give those breaking revisions new endpoints.

View file

@ -106,6 +106,9 @@ Here are the top-level directives:
or you want to start over. **serverName** should be a DNS name that or you want to start over. **serverName** should be a DNS name that
can be publicly resolved. This directive is required. can be publicly resolved. This directive is required.
- **pid:** `String`
Configure the file Telodendria writes its PID to.
- **baseUrl:** `String` - **baseUrl:** `String`
Set the server's base URL. **baseUrl** should be a valid URL, Set the server's base URL. **baseUrl** should be a valid URL,

View file

@ -104,6 +104,9 @@ Main(Array * args)
/* Program configuration */ /* Program configuration */
Config *tConfig; Config *tConfig;
Stream *logFile; Stream *logFile;
Stream *pidFile = NULL;
char *pidPath = NULL;
/* User validation */ /* User validation */
struct passwd *userInfo; struct passwd *userInfo;
@ -335,6 +338,21 @@ start:
Free(token); Free(token);
} }
if (tConfig->pid)
{
pidFile = StreamOpen(tConfig->pid, "w+");
if (!pidFile)
{
char *msg = "Couldn't lock PID file at '%s'";
Log(LOG_ERR, msg, tConfig->pid);
exit = EXIT_FAILURE;
goto finish;
}
pidPath = StrDuplicate(tConfig->pid);
StreamPrintf(pidFile, "%ld", (long) getpid());
StreamClose(pidFile);
}
Log(LOG_DEBUG, "Configuration:"); Log(LOG_DEBUG, "Configuration:");
LogConfigIndent(LogConfigGlobal()); LogConfigIndent(LogConfigGlobal());
Log(LOG_DEBUG, "Server Name: %s", tConfig->serverName); Log(LOG_DEBUG, "Server Name: %s", tConfig->serverName);
@ -604,6 +622,12 @@ finish:
HttpRouterFree(matrixArgs.router); HttpRouterFree(matrixArgs.router);
Log(LOG_DEBUG, "Freed routing tree."); Log(LOG_DEBUG, "Freed routing tree.");
if (pidPath)
{
remove(pidPath);
Free(pidPath);
}
/* /*
* Uninstall the memory hook because it uses the Log * Uninstall the memory hook because it uses the Log
* API, whose configuration is being freed now, so it * API, whose configuration is being freed now, so it