Skip to content

Commit

Permalink
Set the path for CSV retrieval at deploy time
Browse files Browse the repository at this point in the history
  • Loading branch information
waldoj committed Dec 31, 2023
1 parent 37c325c commit 959fba4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
3 changes: 2 additions & 1 deletion cron/sftp.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
set filename [lindex $argv 0]
set output_filename [lindex $argv 1]

spawn sftp {LIS_FTP_USERNAME}@sftp.dlas.virginia.gov:/CSV221/csv241/$filename $output_filename
# Seriously, the path contains "CSV221," no matter hwhat the year or session
spawn sftp {LIS_FTP_USERNAME}@sftp.dlas.virginia.gov:/CSV221/csv{SESSION_LIS_ID}/$filename $output_filename
expect "password"
send "{LIS_FTP_PASSWORD}\n"
expect eof
6 changes: 5 additions & 1 deletion deploy/sftp_credentials.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,8 @@
# Set up FTP credentials in the SFTP script.
sed -i -e "s|{LIS_FTP_PASSWORD}|${LIS_FTP_PASSWORD}|g" cron/sftp.sh
sed -i -e "s|{LIS_FTP_USERNAME}|${LIS_FTP_USERNAME}|g" cron/sftp.sh
sed -i -e "s|{LIS_SESSION_ID}|${LIS_SESSION_ID}|g" cron/sftp.sh

# Put the session ID into the SFTP path, so we fetch the correct LIS CSV
SESSION_LIS_ID=$(grep -oP "SESSION_LIS_ID', '\K([0-9]{3})" includes/settings.inc.php)
sed -i -e "s|{SESSION_LIS_ID}|${SESSION_LIS_ID}|g" cron/sftp.sh

0 comments on commit 959fba4

Please sign in to comment.