1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-01-26 18:58:21 +02:00

Server: Support setting an instance name

This commit is contained in:
Laurent Cozic 2023-07-26 14:42:35 +01:00
parent d78ab16021
commit 36e9e0a33c
2 changed files with 6 additions and 5 deletions

View File

@ -209,10 +209,10 @@ async function main() {
Logger.fsDriver_ = new FsDriverNode();
const globalLogger = new Logger();
// globalLogger.addTarget(TargetType.File, { path: `${config().logDir}/app.txt` });
const instancePrefix = config().INSTANCE_NAME ? `${config().INSTANCE_NAME}: ` : '';
globalLogger.addTarget(TargetType.Console, {
format: '%(date_time)s: [%(level)s] %(prefix)s: %(message)s',
formatInfo: '%(date_time)s: %(prefix)s: %(message)s',
format: `%(date_time)s: ${instancePrefix}[%(level)s] %(prefix)s: %(message)s`,
formatInfo: `%(date_time)s: ${instancePrefix}%(prefix)s: %(message)s`,
});
Logger.initializeGlobalLogger(globalLogger);

View File

@ -27,6 +27,7 @@ const defaultEnvValues: EnvVariables = {
// Additionally, processing services (those defined in setupTaskService.ts)
// only run on the admin instance.
IS_ADMIN_INSTANCE: true,
INSTANCE_NAME: '',
// Maxiumm allowed drift between NTP time and server time. A few
// milliseconds is normally not an issue unless many clients are modifying
@ -116,6 +117,8 @@ export interface EnvVariables {
RUNNING_IN_DOCKER: boolean;
MAX_TIME_DRIFT: number;
NTP_SERVER: string;
IS_ADMIN_INSTANCE: boolean;
INSTANCE_NAME: string;
APP_BASE_URL: string;
USER_CONTENT_BASE_URL: string;
@ -157,8 +160,6 @@ export interface EnvVariables {
USER_DATA_AUTO_DELETE_ENABLED: boolean;
USER_DATA_AUTO_DELETE_AFTER_DAYS: number;
IS_ADMIN_INSTANCE: boolean;
}
const parseBoolean = (s: string): boolean => {