Skip to content

Commit 8cdf803

Browse files
committed
feat: support custom display name (close #189)
1 parent 8eb664e commit 8cdf803

File tree

4 files changed

+31
-5
lines changed

4 files changed

+31
-5
lines changed

README.md

+8
Original file line numberDiff line numberDiff line change
@@ -314,6 +314,14 @@ Here is timezone list at [wikipedia](https://en.wikipedia.org/wiki/List_of_tz_da
314314

315315
Default: `UTC`
316316

317+
#### DISPLAY_NAME
318+
319+
A custom name to identify your vaultwarden instance in notifications and logs.
320+
321+
This doesn't affect functionality, it only affects the display in the notification title and partial log output.
322+
323+
Default: `vaultwarden`
324+
317325
#### DATA_DIR
318326

319327
This folder stores the data of vaultwarden.

README_zh.md

+8
Original file line numberDiff line numberDiff line change
@@ -312,6 +312,14 @@ Rclone 全局参数,详见 [flags](https://rclone.org/flags/)。
312312

313313
默认值:`UTC`
314314

315+
#### DISPLAY_NAME
316+
317+
用于在通知和日志中标识 vaultwarden 实例的自定义名称。
318+
319+
这不会影响功能,仅影响通知标题和部分日志输出中的显示。
320+
321+
默认值:`vaultwarden`
322+
315323
#### DATA_DIR
316324

317325
指定存放 vaultwarden 数据的目录。

scripts/entrypoint.sh

+4-2
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ fi
1212
# mail test
1313
if [[ "$1" == "mail" ]]; then
1414
export_env_file
15+
init_env_display
1516
init_env_mail
1617

1718
MAIL_SMTP_ENABLE="TRUE"
@@ -21,19 +22,20 @@ if [[ "$1" == "mail" ]]; then
2122
MAIL_TO="$2"
2223
fi
2324

24-
send_mail "vaultwarden Backup Test" "Your SMTP configuration looks correct."
25+
send_mail "${DISPLAY_NAME} Backup Test" "Your SMTP configuration looks correct."
2526

2627
exit 0
2728
fi
2829

2930
# ping test
3031
if [[ "$1" == "ping" ]]; then
3132
export_env_file
33+
init_env_display
3234
init_env_ping
3335

3436
PING_DEBUG="TRUE"
3537

36-
send_ping "$2" "vaultwarden Backup Test" "Your PING configuration looks correct."
38+
send_ping "$2" "${DISPLAY_NAME} Backup Test" "Your PING configuration looks correct."
3739

3840
exit 0
3941
fi

scripts/includes.sh

+11-3
Original file line numberDiff line numberDiff line change
@@ -163,9 +163,9 @@ function send_ping() {
163163
# notification content
164164
########################################
165165
function send_notification() {
166-
local SUBJECT_START="vaultwarden Backup Start"
167-
local SUBJECT_SUCCESS="vaultwarden Backup Success"
168-
local SUBJECT_FAILURE="vaultwarden Backup Failed"
166+
local SUBJECT_START="${DISPLAY_NAME} Backup Start"
167+
local SUBJECT_SUCCESS="${DISPLAY_NAME} Backup Success"
168+
local SUBJECT_FAILURE="${DISPLAY_NAME} Backup Failed"
169169

170170
case "$1" in
171171
start)
@@ -301,6 +301,7 @@ function init_env() {
301301

302302
init_env_dir
303303
init_env_db
304+
init_env_display
304305
init_env_ping
305306
init_env_mail
306307

@@ -413,6 +414,7 @@ function init_env() {
413414
color yellow "MAIL_WHEN_FAILURE: ${MAIL_WHEN_FAILURE}"
414415
fi
415416
color yellow "TIMEZONE: ${TIMEZONE}"
417+
color yellow "DISPLAY_NAME: ${DISPLAY_NAME}"
416418
color yellow "========================================"
417419
}
418420

@@ -512,6 +514,12 @@ function init_env_db() {
512514
fi
513515
}
514516

517+
function init_env_display() {
518+
# DISPLAY_NAME
519+
get_env DISPLAY_NAME
520+
DISPLAY_NAME="${DISPLAY_NAME:-"vaultwarden"}"
521+
}
522+
515523
function init_env_ping() {
516524
# PING_URL
517525
get_env PING_URL

0 commit comments

Comments
 (0)