1
0
Fork 0
mirror of https://github.com/Eggbertx/gochan.git synced 2025-08-25 09:36:24 -07:00

Add sqlite3 support to vagrant tools

This commit is contained in:
Eggbertx 2022-12-15 15:19:15 -08:00
parent 976d9ad53a
commit fd97da86cd
3 changed files with 7 additions and 2 deletions

View file

@ -6,6 +6,8 @@ if [ "$DBTYPE" = "mysql" ] || [ -z "$DBTYPE" ]; then
mysql -stu gochan -D gochan -pgochan
elif [ "$DBTYPE" = "postgresql" ]; then
psql -U gochan -h 127.0.0.1 gochan
elif [ "$DBTYPE" = "sqlite3" ]; then
sqlite3 /etc/gochan/gochan.db
else
echo "DB type '$DBTYPE' not supported"
fi

4
vagrant/Vagrantfile vendored
View file

@ -2,8 +2,8 @@
# vi: set ft=ruby :
DBTYPE = ENV.fetch("GC_DBTYPE", "mysql")
if DBTYPE != "mysql" && DBTYPE != "postgresql" && DBTYPE != "sqlite"
puts "Invalid GC_DBTYPE environment variable set in the host, must be mysql, postgresql, or sqlite, got #{DBTYPE}"
if DBTYPE != "mysql" && DBTYPE != "postgresql" && DBTYPE != "sqlite3"
puts "Invalid GC_DBTYPE environment variable set in the host, must be mysql, postgresql, or sqlite3, got #{DBTYPE}"
abort
end

View file

@ -109,6 +109,9 @@ sed -i /etc/gochan/gochan.json \
if [ "$DBTYPE" = "postgresql" ]; then
sed -i /etc/gochan/gochan.json \
-e 's/"DBhost": ".*"/"DBhost": "127.0.0.1"/'
elif [ "$DBTYPE" = "sqlite3" ]; then
sed -i /etc/gochan/gochan.json \
-e 's#"DBhost": ".*"#"DBhost": "/etc/gochan/gochan.db"#'
fi
# a convenient script for connecting to the db, whichever type we're using