Skip to content

Commit 5b6f8e2

Browse files
authored
NginxProxymanager: set Certbot version in npm.service environment variable (2.15.0) (#14843)
1 parent 162cb9b commit 5b6f8e2

2 files changed

Lines changed: 9 additions & 1 deletion

File tree

ct/nginxproxymanager.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,12 @@ EOF
216216
msg_ok "Initialized Backend"
217217

218218
msg_info "Starting Services"
219+
CERTBOT_VER=$(/opt/certbot/bin/certbot --version 2>&1 | awk '{print $NF}')
220+
if grep -q "Environment=CERTBOT_VERSION" /lib/systemd/system/npm.service; then
221+
sed -i "s|Environment=CERTBOT_VERSION=.*|Environment=CERTBOT_VERSION=${CERTBOT_VER}|" /lib/systemd/system/npm.service
222+
else
223+
sed -i "/Environment=NODE_ENV=production/a Environment=CERTBOT_VERSION=${CERTBOT_VER}" /lib/systemd/system/npm.service
224+
fi
219225
sed -i 's/user npm/user root/g; s/^pid/#pid/g' /usr/local/openresty/nginx/conf/nginx.conf
220226
sed -r -i 's/^([[:space:]]*)su npm npm/\1#su npm npm/g;' /etc/logrotate.d/nginx-proxy-manager
221227
systemctl daemon-reload

install/nginxproxymanager-install.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,8 @@ $STD yarn install --network-timeout 600000
160160
msg_ok "Initialized Backend"
161161

162162
msg_info "Creating Service"
163-
cat <<'EOF' >/lib/systemd/system/npm.service
163+
CERTBOT_VER=$(/opt/certbot/bin/certbot --version 2>&1 | awk '{print $NF}')
164+
cat <<EOF >/lib/systemd/system/npm.service
164165
[Unit]
165166
Description=Nginx Proxy Manager
166167
After=network.target
@@ -169,6 +170,7 @@ Wants=openresty.service
169170
[Service]
170171
Type=simple
171172
Environment=NODE_ENV=production
173+
Environment=CERTBOT_VERSION=${CERTBOT_VER}
172174
ExecStartPre=-mkdir -p /tmp/nginx/body /data/letsencrypt-acme-challenge
173175
ExecStart=/usr/bin/node index.js --abort_on_uncaught_exception --max_old_space_size=250
174176
WorkingDirectory=/app

0 commit comments

Comments
 (0)