Allow to read env vars from files inside the "env.d" directory

This makes it easier to set environment variables on some operating systems.
Setting configuration options from environment variables is recommended if
you want to avoid the time-consuming task of merging your changes with the
default configuration file after upgrading SFTPGo

Signed-off-by: Nicola Murino <nicola.murino@gmail.com>
This commit is contained in:
Nicola Murino
2022-10-13 18:43:58 +02:00
parent 3822b7d3f7
commit 13ee236884
11 changed files with 83 additions and 17 deletions

View File

@@ -24,15 +24,15 @@ if [ "$1" = "configure" ]; then
sftpgo initprovider -c /etc/sftpgo
# ensure files and folders have the appropriate permissions
chown -R sftpgo:sftpgo /etc/sftpgo /var/lib/sftpgo /srv/sftpgo
chmod 750 /etc/sftpgo /var/lib/sftpgo /srv/sftpgo
chmod 750 /etc/sftpgo /etc/sftpgo/env.d /var/lib/sftpgo /srv/sftpgo
chmod 640 /etc/sftpgo/sftpgo.json
fi
# we added /srv/sftpgo after 1.1.0, we should check if we are upgrading
# from this version but a non-recursive chmod/chown shouldn't hurt
if [ -d /srv/sftpgo ]; then
chown sftpgo:sftpgo /srv/sftpgo
chmod 750 /srv/sftpgo
# we added /etc/sftpgo/env.d in v2.4.0, we should check if we are upgrading
# from a previous version but a non-recursive chmod/chown shouldn't hurt
if [ -d /etc/sftpgo/env.d ]; then
chown sftpgo:sftpgo /etc/sftpgo/env.d
chmod 750 /etc/sftpgo/env.d
fi
# set the cap_net_bind_service capability so the service can bind to privileged ports

View File

@@ -1,2 +1,3 @@
/var/lib/sftpgo
/srv/sftpgo
/etc/sftpgo/env.d