Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Support custom sqlite path, add APP_KEY to readme
  • Loading branch information
thespad committed Feb 8, 2024
commit 0cd82a59b442a78a7a65a99a05ae5b3c4b9149b8
1 change: 1 addition & 0 deletions readme-vars.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ param_ports:

opt_param_usage_include_env: true
opt_param_env_vars:
- { env_var: "APP_KEY", env_value: "", desc: "App key used for encrypting stored data. Generate with `docker exec speedtest-tracker php /app/www/artisan key:generate --show`" }
- { env_var: "DB_HOST", env_value: "", desc: "Database hostname (postgres/mysql)." }
- { env_var: "DB_PORT", env_value: "", desc: "Database port (postgres/mysql)." }
- { env_var: "DB_DATABASE", env_value: "", desc: "Database name (postgres/mysql)." }
Expand Down
23 changes: 15 additions & 8 deletions root/etc/s6-overlay/s6-rc.d/init-speedtest-tracker-config/run
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,20 @@ lsiown abc:abc \
/config

if [[ "${DB_CONNECTION:=sqlite}" = "sqlite" ]]; then
touch /config/database.sqlite
if [[ -e "/app/www/database/database.sqlite" && ! -L "/app/www/database/database.sqlite" ]]; then
rm -rf "/app/www/database/database.sqlite"
fi
if [[ ! -L "/app/www/database/database.sqlite" ]]; then
ln -s "/config/database.sqlite" "/app/www/database/database.sqlite"
if [[ -n "${DB_DATABASE}" ]]; then
if [[ ! -e "${DB_DATABASE}" ]]; then
touch "${DB_DATABASE}"
lsiown abc:abc "${DB_DATABASE}"
fi
else
touch /config/database.sqlite
if [[ -e "/app/www/database/database.sqlite" && ! -L "/app/www/database/database.sqlite" ]]; then
rm -rf "/app/www/database/database.sqlite"
fi
if [[ ! -L "/app/www/database/database.sqlite" ]]; then
ln -s "/config/database.sqlite" "/app/www/database/database.sqlite"
fi
lsiown abc:abc /app/www/database/database.sqlite
fi
elif [[ "${DB_CONNECTION}" = "mysql" ]]; then
echo "Waiting for DB to be available"
Expand Down Expand Up @@ -50,8 +58,7 @@ fi

lsiown -R abc:abc \
/app/www/bootstrap/cache \
/app/www/storage \
/app/www/database
/app/www/storage

# Check for env file
if [[ ! -f /config/.env ]]; then
Expand Down