Skip to content

Commit 7eea155

Browse files
committed
perf: udpate user
1 parent fae43b9 commit 7eea155

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

init.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
#!/bin/bash
22
#
33

4+
BASIC_AUTH_USER=${BASIC_AUTH_USER:-admin}
5+
46
function config_nginx() {
57
config_file=$1
68
if [ ! -f "${config_file}" ]; then
@@ -35,7 +37,7 @@ function config_nginx() {
3537
fi
3638

3739
if [ -n "${BASIC_AUTH_PASSWORD}" ] ; then
38-
htpasswd -b /etc/nginx/.htpasswd admin ${BASIC_AUTH_PASSWORD}
40+
htpasswd -bc /etc/nginx/.htpasswd ${BASIC_AUTH_USER} ${BASIC_AUTH_PASSWORD}
3941
sed -i "s@# auth_basic .*;@auth_basic \"Restricted Area\";@g" "${config_file}"
4042
sed -i "s@# auth_basic_user_file .*;@auth_basic_user_file /etc/nginx/.htpasswd;@g" "${config_file}"
4143
else

0 commit comments

Comments
 (0)