[ADD/TOOL] Add -j flag for parsee-config

This commit is contained in:
lda 2025-02-19 15:38:22 +00:00
parent fd1b3499b6
commit b78f7b6ab3
2 changed files with 15 additions and 2 deletions

View file

@ -1,6 +1,6 @@
." The last field is the codename, by the way.
." ALL MANPAGES FOR PARSEE ARE UNDER PUBLIC DOMAIN
.TH parsee-config 1 "Parsee Utility" "star-of-hope"
.TH parsee-config 1 "Parsee Utility" "lunar-rainbow"
.SH NAME
parsee-config - generate a basic configuration file
@ -11,6 +11,7 @@ parsee-config
.B [-s SHARED_SECRET]
.B [-m MEDIA_URL]
.B [-J JABBER_HOST]
.B [-j JABBER_ADDR]
.B [-p JABBER_PORT]
.B [-d DATABASE]
.B [-M MAX_STANZA]
@ -34,6 +35,7 @@ $ parsee-config \\
-H 'blow.hole' \\
-s 'The Dark Shared Secret' \\
-J 'xmpp.blow.hole' \\
-j 'localhost' \\
-S 128
.fi
.if n \{\
@ -68,6 +70,12 @@ media. It must be publicly accessible (behind a reverse proxy to HTTP:7642)
.I JABBER_HOST
is used as the component host for Parsee.
.TP
.BR -j JABBER_ADDR
.I JABBER_ADDR
can optionally be used to change the hostname Parsee will try to contact
for XMPP. Users should ideally use localhost (or a hostname pointing to
the server itself), as XMPP component streams are not encrypted.
.TP
.BR -p JABBER_PORT
.I JABBER_PORT
is used as the component post for Parsee. Parsee uses it alongside

View file

@ -20,6 +20,7 @@ Main(Array *args, HashMap *env)
Uri *api_base;
char *homeserver = NULL, *jcp = NULL, *jabber = NULL;
char *data = NULL, *media = NULL, *listen = NULL;
char *component_as = NULL;
int flag, code = EXIT_FAILURE;
int port = 5347;
size_t lmdb_size = 0;
@ -28,7 +29,7 @@ Main(Array *args, HashMap *env)
listen = "localhost";
ArgParseStateInit(&state);
while ((flag = ArgParse(&state, args, "H:J:s:d:p:m:l:S:M:")) != -1)
while ((flag = ArgParse(&state, args, "H:J:j:s:d:p:m:l:S:M:")) != -1)
{
switch (flag)
{
@ -45,6 +46,9 @@ Main(Array *args, HashMap *env)
case 'J':
jabber = state.optArg;
break;
case 'j':
component_as = state.optArg;
break;
case 'd':
data = state.optArg;
break;
@ -123,6 +127,7 @@ Main(Array *args, HashMap *env)
JsonSet(json, JsonValueString(media), 1, "media_base");
JsonSet(json, JsonValueString(listen), 1, "listen_as");
JsonSet(json, JsonValueString(component_as), 1, "component_addr");
JsonEncode(json, file, JSON_PRETTY);
StreamFlush(file);