Merge pull request #7 from IronicBadger/master

Enables customization of results page
This commit is contained in:
aptalca 2020-09-26 11:14:22 -04:00 committed by GitHub
commit d68e66dd6e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 1 deletions

View File

@ -37,6 +37,7 @@ param_env_vars:
# optional container parameters
opt_param_usage_include_env: true
opt_param_env_vars:
- { env_var: "CUSTOM_RESULTS", env_value: "true", desc: "(optional) enables custom results page in `/config/www/results/index.php`."}
- { env_var: "DB_TYPE", env_value: "sqlite", desc: "Defaults to `sqlite`, can also be set to `mysql` or `postgresql`."}
- { env_var: "DB_NAME", env_value: "DB_NAME", desc: "Database name. Required for mysql and pgsql."}
- { env_var: "DB_HOSTNAME", env_value: "DB_HOSTNAME", desc: "Database address. Required for mysql and pgsql."}
@ -57,6 +58,8 @@ app_setup_block: |
If you are setting up a mysql or postgresql database, you first need to import the tables into your database as described at the following link
https://github.com/librespeed/speedtest/blob/master/doc.md#creating-the-database
To enable a custom results page set the environment variable `CUSTOM_RESULTS=true` and start (or restart) the container at least once for `/config/www/results/index.php` to be created and modify this file to your liking.
# changelog
changelogs:
- { date: "01.06.20:", desc: "Rebasing to alpine 3.12." }

View File

@ -2,7 +2,8 @@
# make our folders
mkdir -p \
/config/www
/config/www \
/config/www/img
# create symlink to index.html
[[ ! -L /usr/share/webapps/librespeed/index.html ]] && \
@ -17,6 +18,15 @@ cp /usr/share/webapps/librespeed/example*.html /config/www/
[[ -f /config/www/speedtest_worker.js ]] && \
cp /config/www/speedtest_worker.js /usr/share/webapps/librespeed/speedtest_worker.js
# enables custom results page
if "$CUSTOM_RESULTS"; then
echo "custom results"
[[ ! -e "/config/www/results/index.php" ]] && \
mkdir -p /config/www/results/ && \
mv /usr/share/webapps/librespeed/results/index.php /config/www/results/index.php
ln -sf /config/www/results/index.php /usr/share/webapps/librespeed/results/index.php
fi
# configure app settings
sed -i "\
s|\$Sqlite_db_file = \"../../speedtest_telemetry.sql\";|\$Sqlite_db_file = \"/config/speedtest_telemetry.sql\";|g; \