X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=systemd%2Fsfa-db-init.sh;h=f28d7bd47e4a7536c503a944d06dc2625023b74f;hb=c5c626c1ef595d04b9d0c2a092885379d97c198b;hp=1a030fd95692fc65dd71c743fc7c475c82e73f65;hpb=1a6a1e0c6d823ec6065d74297527ac775416d9c5;p=sfa.git diff --git a/systemd/sfa-db-init.sh b/systemd/sfa-db-init.sh index 1a030fd9..f28d7bd4 100755 --- a/systemd/sfa-db-init.sh +++ b/systemd/sfa-db-init.sh @@ -18,12 +18,6 @@ sfa_local_config=/etc/sfa/configs/site_config sfa_local_config_xml=/etc/sfa/configs/site_config.xml sfa_local_config_sh=/etc/sfa/sfa_config.sh -# source shell config if present; might not be the very first time -[ -f $sfa_local_config_sh ] && source $sfa_local_config_sh - -# Export so that we do not have to specify -p to psql invocations -export PGPORT=$SFA_DB_PORT - # Regenerate configuration files - almost verbatim from plc.init function reconfigure () { @@ -108,7 +102,7 @@ function start () { echo "local all all trust" >> $pg_hba_conf # Disable access to our DB from all hosts - sed -i -e "/^host ${SFA_DB_NAME}/d' $pg_hba_conf + sed -i -e "/^host ${SFA_DB_NAME}/d" $pg_hba_conf # grant access { echo "host $SFA_DB_NAME $SFA_DB_USER 127.0.0.1/32 password" @@ -145,4 +139,13 @@ function start () { } +# source shell config if present +# but it might not be present the very first time +[ ! -f $sfa_local_config_sh ] && reconfigure + +source $sfa_local_config_sh + +# Export so that we do not have to specify -p to psql invocations +export PGPORT=$SFA_DB_PORT + start