Skip to content

Commit

Permalink
changes
Browse files Browse the repository at this point in the history
  • Loading branch information
sean-david-welch committed Jun 16, 2024
1 parent cf223da commit 8100893
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
1 change: 1 addition & 0 deletions .github/workflows/server.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -79,5 +79,6 @@ jobs:
echo ${{ secrets.SUDO_PASSWORD }} | sudo -S systemctl stop farmec.service
sudo rm -f /home/seanwelch/server/bin/main
sudo cp /home/seanwelch/bin/main /home/seanwelch/server/bin/main
sudo chmod +x /home/seanwelch/server/bin/main
echo ${{ secrets.SUDO_PASSWORD }} | sudo -S systemctl start farmec.service
echo ${{ secrets.SUDO_PASSWORD }} | sudo -S systemctl restart nginx
12 changes: 11 additions & 1 deletion server/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"database/sql"
"log"
"os"
"path/filepath"

"github.com/gin-contrib/cors"
"github.com/gin-gonic/gin"
Expand All @@ -24,7 +25,16 @@ func main() {
log.Fatal("Error loading configuration: ", err)
}

database, err := sql.Open("sqlite3", "./database/database.db")
cwd, err := os.Getwd()
if err != nil {
log.Fatal("Error getting current working directory: ", err)
}
log.Println("Current working directory:", cwd)

databasePath := filepath.Join(cwd, "database/database.db")
log.Println("Database path:", databasePath)

database, err := sql.Open("sqlite3", databasePath)
if err != nil {
log.Fatal(err)
}
Expand Down

0 comments on commit 8100893

Please sign in to comment.