forked from Telodendria/Telodendria
Print admin registration token to configured log, not default stdout.
If Telodendria is started as a daemon and is logging to the syslog, we want the token to show up in the syslog.
This commit is contained in:
parent
6ec87b8d76
commit
78302d6320
2 changed files with 18 additions and 5 deletions
5
TODO.txt
5
TODO.txt
|
@ -40,10 +40,13 @@ Milestone: v0.4.0
|
||||||
[ ] How to set default value of true on boolean?
|
[ ] How to set default value of true on boolean?
|
||||||
- defaults probably need to be set at parser level, not
|
- defaults probably need to be set at parser level, not
|
||||||
enough to set it after.
|
enough to set it after.
|
||||||
|
- Or booleans should default to -1 if not specified, let the
|
||||||
|
higher level logic set the default from there.
|
||||||
|
[ ] Write man page.
|
||||||
|
|
||||||
[ ] Refactor MatrixErrorCreate() to take a custom message or NULL to
|
[ ] Refactor MatrixErrorCreate() to take a custom message or NULL to
|
||||||
use the default. This will make debugging a lot easier.
|
use the default. This will make debugging a lot easier.
|
||||||
[ ] Make sure admin registration token is printed to log, not stdout.
|
[x] Make sure admin registration token is printed to log, not stdout.
|
||||||
Unless they are the same, of course.
|
Unless they are the same, of course.
|
||||||
[ ] Refactor Config to use j2s.
|
[ ] Refactor Config to use j2s.
|
||||||
|
|
||||||
|
|
18
src/Main.c
18
src/Main.c
|
@ -121,6 +121,8 @@ Main(Array * args)
|
||||||
|
|
||||||
char startDir[PATH_MAX];
|
char startDir[PATH_MAX];
|
||||||
|
|
||||||
|
char *token;
|
||||||
|
|
||||||
start:
|
start:
|
||||||
/* Global variables */
|
/* Global variables */
|
||||||
httpServers = NULL;
|
httpServers = NULL;
|
||||||
|
@ -140,6 +142,8 @@ start:
|
||||||
groupInfo = NULL;
|
groupInfo = NULL;
|
||||||
cron = NULL;
|
cron = NULL;
|
||||||
|
|
||||||
|
token = NULL;
|
||||||
|
|
||||||
memset(&matrixArgs, 0, sizeof(matrixArgs));
|
memset(&matrixArgs, 0, sizeof(matrixArgs));
|
||||||
|
|
||||||
if (!LogConfigGlobal())
|
if (!LogConfigGlobal())
|
||||||
|
@ -226,7 +230,6 @@ start:
|
||||||
|
|
||||||
if (!ConfigExists(matrixArgs.db))
|
if (!ConfigExists(matrixArgs.db))
|
||||||
{
|
{
|
||||||
char *token;
|
|
||||||
RegTokenInfo *info;
|
RegTokenInfo *info;
|
||||||
|
|
||||||
Log(LOG_NOTICE, "No configuration exists in the opened database.");
|
Log(LOG_NOTICE, "No configuration exists in the opened database.");
|
||||||
|
@ -253,11 +256,11 @@ start:
|
||||||
goto finish;
|
goto finish;
|
||||||
}
|
}
|
||||||
|
|
||||||
Log(LOG_NOTICE, "Admin Registration token: %s", token);
|
|
||||||
|
|
||||||
Free(token);
|
|
||||||
RegTokenClose(info);
|
RegTokenClose(info);
|
||||||
RegTokenFree(info);
|
RegTokenFree(info);
|
||||||
|
|
||||||
|
/* Don't free token, because we need to print it when logging is
|
||||||
|
* set up. */
|
||||||
}
|
}
|
||||||
|
|
||||||
Log(LOG_NOTICE, "Loading configuration...");
|
Log(LOG_NOTICE, "Loading configuration...");
|
||||||
|
@ -336,6 +339,13 @@ start:
|
||||||
goto finish;
|
goto finish;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* If a token was created with a default config, print it to the log */
|
||||||
|
if (token)
|
||||||
|
{
|
||||||
|
Log(LOG_NOTICE, "Admin Registration token: %s", token);
|
||||||
|
Free(token);
|
||||||
|
}
|
||||||
|
|
||||||
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);
|
||||||
|
|
Loading…
Reference in a new issue