diff --git a/.github/ISSUE_TEMPLATE/issue.bug.md b/.github/ISSUE_TEMPLATE/issue.bug.md
deleted file mode 100755
index 1d269c9..0000000
--- a/.github/ISSUE_TEMPLATE/issue.bug.md
+++ /dev/null
@@ -1,40 +0,0 @@
----
-name: Bug report
-about: Create a report to help us improve
-
----
-[linuxserverurl]: https://linuxserver.io
-[][linuxserverurl]
-
-
-
-
-
-------------------------------
-
-## Expected Behavior
-
-
-## Current Behavior
-
-
-## Steps to Reproduce
-
-
-1.
-2.
-3.
-4.
-
-## Environment
-**OS:**
-**CPU architecture:** x86_64/arm32/arm64
-**How docker service was installed:**
-
-
-
-## Command used to create docker container (run/create/compose/screenshot)
-
-
-## Docker logs
-
diff --git a/.github/ISSUE_TEMPLATE/issue.bug.yml b/.github/ISSUE_TEMPLATE/issue.bug.yml
new file mode 100755
index 0000000..59a10f5
--- /dev/null
+++ b/.github/ISSUE_TEMPLATE/issue.bug.yml
@@ -0,0 +1,77 @@
+# Based on the issue template
+name: Bug report
+description: Create a report to help us improve
+title: "[BUG]
"
+labels: [Bug]
+body:
+ - type: checkboxes
+ attributes:
+ label: Is there an existing issue for this?
+ description: Please search to see if an issue already exists for the bug you encountered.
+ options:
+ - label: I have searched the existing issues
+ required: true
+ - type: textarea
+ attributes:
+ label: Current Behavior
+ description: Tell us what happens instead of the expected behavior.
+ validations:
+ required: true
+ - type: textarea
+ attributes:
+ label: Expected Behavior
+ description: Tell us what should happen.
+ validations:
+ required: false
+ - type: textarea
+ attributes:
+ label: Steps To Reproduce
+ description: Steps to reproduce the behavior.
+ placeholder: |
+ 1. In this environment...
+ 2. With this config...
+ 3. Run '...'
+ 4. See error...
+ validations:
+ required: true
+ - type: textarea
+ attributes:
+ label: Environment
+ description: |
+ examples:
+ - **OS**: Ubuntu 20.04
+ - **How docker service was installed**: distro's packagemanager
+ value: |
+ - OS:
+ - How docker service was installed:
+ render: markdown
+ validations:
+ required: false
+ - type: dropdown
+ attributes:
+ label: CPU architecture
+ options:
+ - x86-64
+ - arm64
+ - armhf
+ validations:
+ required: true
+ - type: textarea
+ attributes:
+ label: Docker creation
+ description: |
+ Command used to create docker container
+ Provide your docker create/run command or compose yaml snippet, or a screenshot of settings if using a gui to create the container
+ render: bash
+ validations:
+ required: true
+ - type: textarea
+ attributes:
+ description: |
+ Provide a full docker log, output of "docker logs linuxserver.io"
+ label: Container logs
+ placeholder: |
+ Output of `docker logs linuxserver.io`
+ render: bash
+ validations:
+ required: true
diff --git a/.github/ISSUE_TEMPLATE/issue.feature.md b/.github/ISSUE_TEMPLATE/issue.feature.md
deleted file mode 100755
index 20a91fd..0000000
--- a/.github/ISSUE_TEMPLATE/issue.feature.md
+++ /dev/null
@@ -1,25 +0,0 @@
----
-name: Feature request
-about: Suggest an idea for this project
-
----
-[linuxserverurl]: https://linuxserver.io
-[][linuxserverurl]
-
-
-
-
-
-
-
-
-------------------------------
-
-## Desired Behavior
-
-
-## Current Behavior
-
-
-## Alternatives Considered
-
diff --git a/.github/ISSUE_TEMPLATE/issue.feature.yml b/.github/ISSUE_TEMPLATE/issue.feature.yml
new file mode 100755
index 0000000..099dcdb
--- /dev/null
+++ b/.github/ISSUE_TEMPLATE/issue.feature.yml
@@ -0,0 +1,31 @@
+# Based on the issue template
+name: Feature request
+description: Suggest an idea for this project
+title: "[FEAT] "
+labels: [enhancement]
+body:
+ - type: checkboxes
+ attributes:
+ label: Is this a new feature request?
+ description: Please search to see if a feature request already exists.
+ options:
+ - label: I have searched the existing issues
+ required: true
+ - type: textarea
+ attributes:
+ label: Wanted change
+ description: Tell us what you want to happen.
+ validations:
+ required: true
+ - type: textarea
+ attributes:
+ label: Reason for change
+ description: Justify your request, why do you want it, what is the benefit.
+ validations:
+ required: true
+ - type: textarea
+ attributes:
+ label: Proposed code change
+ description: Do you have a potential code change in mind?
+ validations:
+ required: false
diff --git a/.github/workflows/call_invalid_helper.yml b/.github/workflows/call_invalid_helper.yml
new file mode 100644
index 0000000..773767c
--- /dev/null
+++ b/.github/workflows/call_invalid_helper.yml
@@ -0,0 +1,12 @@
+name: Comment on invalid interaction
+on:
+ issues:
+ types:
+ - labeled
+jobs:
+ add-comment-on-invalid:
+ if: github.event.label.name == 'invalid'
+ permissions:
+ issues: write
+ uses: linuxserver/github-workflows/.github/workflows/invalid-interaction-helper.yml@v1
+ secrets: inherit
diff --git a/.github/workflows/external_trigger.yml b/.github/workflows/external_trigger.yml
index c8d9e74..9338da5 100755
--- a/.github/workflows/external_trigger.yml
+++ b/.github/workflows/external_trigger.yml
@@ -7,7 +7,7 @@ jobs:
external-trigger-master:
runs-on: ubuntu-latest
steps:
- - uses: actions/checkout@v2.3.3
+ - uses: actions/checkout@v3.1.0
- name: External Trigger
if: github.ref == 'refs/heads/master'
@@ -48,8 +48,12 @@ jobs:
| jq -r '.config.digest')
image_info=$(curl -sL \
--header "Authorization: Bearer ${token}" \
- "https://ghcr.io/v2/${image}/blobs/${digest}" \
- | jq -r '.container_config')
+ "https://ghcr.io/v2/${image}/blobs/${digest}")
+ if [[ $(echo $image_info | jq -r '.container_config') == "null" ]]; then
+ image_info=$(echo $image_info | jq -r '.config')
+ else
+ image_info=$(echo $image_info | jq -r '.container_config')
+ fi
IMAGE_RELEASE=$(echo ${image_info} | jq -r '.Labels.build_version' | awk '{print $3}')
IMAGE_VERSION=$(echo ${IMAGE_RELEASE} | awk -F'-ls' '{print $1}')
if [ -z "${IMAGE_VERSION}" ]; then
diff --git a/.github/workflows/external_trigger_scheduler.yml b/.github/workflows/external_trigger_scheduler.yml
index 70dfeed..230859b 100755
--- a/.github/workflows/external_trigger_scheduler.yml
+++ b/.github/workflows/external_trigger_scheduler.yml
@@ -9,7 +9,7 @@ jobs:
external-trigger-scheduler:
runs-on: ubuntu-latest
steps:
- - uses: actions/checkout@v2.3.3
+ - uses: actions/checkout@v3.1.0
with:
fetch-depth: '0'
diff --git a/.github/workflows/greetings.yml b/.github/workflows/greetings.yml
index 50c5c26..c39d90b 100755
--- a/.github/workflows/greetings.yml
+++ b/.github/workflows/greetings.yml
@@ -8,6 +8,6 @@ jobs:
steps:
- uses: actions/first-interaction@v1
with:
- issue-message: 'Thanks for opening your first issue here! Be sure to follow the [bug](https://github.com/linuxserver/docker-bookstack/blob/master/.github/ISSUE_TEMPLATE/issue.bug.md) or [feature](https://github.com/linuxserver/docker-bookstack/blob/master/.github/ISSUE_TEMPLATE/issue.feature.md) issue templates!'
+ issue-message: 'Thanks for opening your first issue here! Be sure to follow the [bug](https://github.com/linuxserver/docker-bookstack/blob/master/.github/ISSUE_TEMPLATE/issue.bug.yml) or [feature](https://github.com/linuxserver/docker-bookstack/blob/master/.github/ISSUE_TEMPLATE/issue.feature.yml) issue templates!'
pr-message: 'Thanks for opening this pull request! Be sure to follow the [pull request template](https://github.com/linuxserver/docker-bookstack/blob/master/.github/PULL_REQUEST_TEMPLATE.md)!'
repo-token: ${{ secrets.GITHUB_TOKEN }}
diff --git a/.github/workflows/package_trigger.yml b/.github/workflows/package_trigger.yml
index 11c927a..5000ec3 100755
--- a/.github/workflows/package_trigger.yml
+++ b/.github/workflows/package_trigger.yml
@@ -7,7 +7,7 @@ jobs:
package-trigger-master:
runs-on: ubuntu-latest
steps:
- - uses: actions/checkout@v2.3.3
+ - uses: actions/checkout@v3.1.0
- name: Package Trigger
if: github.ref == 'refs/heads/master'
diff --git a/.github/workflows/package_trigger_scheduler.yml b/.github/workflows/package_trigger_scheduler.yml
index e2b1b85..6fb6d98 100755
--- a/.github/workflows/package_trigger_scheduler.yml
+++ b/.github/workflows/package_trigger_scheduler.yml
@@ -9,7 +9,7 @@ jobs:
package-trigger-scheduler:
runs-on: ubuntu-latest
steps:
- - uses: actions/checkout@v2.3.3
+ - uses: actions/checkout@v3.1.0
with:
fetch-depth: '0'
diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml
index 3b3846e..73dfe45 100755
--- a/.github/workflows/stale.yml
+++ b/.github/workflows/stale.yml
@@ -10,7 +10,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- - uses: actions/stale@v3
+ - uses: actions/stale@v6.0.1
with:
stale-issue-message: "This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions."
stale-pr-message: "This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions."
diff --git a/Jenkinsfile b/Jenkinsfile
index 90a5c64..7455504 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -59,7 +59,7 @@ pipeline {
env.CODE_URL = 'https://github.com/' + env.LS_USER + '/' + env.LS_REPO + '/commit/' + env.GIT_COMMIT
env.DOCKERHUB_LINK = 'https://hub.docker.com/r/' + env.DOCKERHUB_IMAGE + '/tags/'
env.PULL_REQUEST = env.CHANGE_ID
- env.TEMPLATED_FILES = 'Jenkinsfile README.md LICENSE .editorconfig ./.github/CONTRIBUTING.md ./.github/FUNDING.yml ./.github/ISSUE_TEMPLATE/config.yml ./.github/ISSUE_TEMPLATE/issue.bug.md ./.github/ISSUE_TEMPLATE/issue.feature.md ./.github/PULL_REQUEST_TEMPLATE.md ./.github/workflows/external_trigger_scheduler.yml ./.github/workflows/greetings.yml ./.github/workflows/package_trigger_scheduler.yml ./.github/workflows/stale.yml ./.github/workflows/external_trigger.yml ./.github/workflows/package_trigger.yml'
+ env.TEMPLATED_FILES = 'Jenkinsfile README.md LICENSE .editorconfig ./.github/CONTRIBUTING.md ./.github/FUNDING.yml ./.github/ISSUE_TEMPLATE/config.yml ./.github/ISSUE_TEMPLATE/issue.bug.yml ./.github/ISSUE_TEMPLATE/issue.feature.yml ./.github/PULL_REQUEST_TEMPLATE.md ./.github/workflows/external_trigger_scheduler.yml ./.github/workflows/greetings.yml ./.github/workflows/package_trigger_scheduler.yml ./.github/workflows/stale.yml ./.github/workflows/external_trigger.yml ./.github/workflows/package_trigger.yml'
}
script{
env.LS_RELEASE_NUMBER = sh(
@@ -287,7 +287,7 @@ pipeline {
echo "Jenkinsfile is up to date."
fi
# Stage 2 - Delete old templates
- OLD_TEMPLATES=".github/ISSUE_TEMPLATE.md"
+ OLD_TEMPLATES=".github/ISSUE_TEMPLATE.md\n.github/ISSUE_TEMPLATE/issue.bug.md\n.github/ISSUE_TEMPLATE/issue.feature.md"
for i in ${OLD_TEMPLATES}; do
if [[ -f "${i}" ]]; then
TEMPLATES_TO_DELETE="${i} ${TEMPLATES_TO_DELETE}"
diff --git a/README.md b/README.md
index 3da97c9..398e761 100644
--- a/README.md
+++ b/README.md
@@ -101,6 +101,7 @@ services:
- PGID=1000
- APP_URL=
- DB_HOST=bookstack_db
+ - DB_PORT=3306
- DB_USER=bookstack
- DB_PASS=
- DB_DATABASE=bookstackapp
@@ -137,6 +138,7 @@ docker run -d \
-e PGID=1000 \
-e APP_URL= \
-e DB_HOST= \
+ -e DB_PORT= \
-e DB_USER= \
-e DB_PASS= \
-e DB_DATABASE=bookstackapp \
@@ -157,9 +159,10 @@ Container images are configured using parameters passed at runtime (such as thos
| `-e PGID=1000` | for GroupID - see below for explanation |
| `-e APP_URL=` | for specifying the IP:port or URL your application will be accessed on (ie. `http://192.168.1.1:6875` or `https://bookstack.mydomain.com` |
| `-e DB_HOST=` | for specifying the database host |
+| `-e DB_PORT=` | for specifying the database port if not default 3306 |
| `-e DB_USER=` | for specifying the database user |
-| `-e DB_PASS=` | for specifying the database password |
-| `-e DB_DATABASE=bookstackapp` | for specifying the database to be used (non-alphanumeric passwords must be properly escaped.) |
+| `-e DB_PASS=` | for specifying the database password (non-alphanumeric passwords must be properly escaped.) |
+| `-e DB_DATABASE=bookstackapp` | for specifying the database to be used |
| `-v /config` | this will store any uploaded data on the docker host |
## Environment variables from files (Docker secrets)
@@ -271,6 +274,7 @@ Once registered you can define the dockerfile to use with `-f Dockerfile.aarch64
## Versions
+* **21.12.22:** - Update db info in .env file when env vars are updated.
* **10.10.22:** - Remove password escape logic which caused problems for a small subset of users.
* **20.08.22:** - Rebasing to alpine 3.15 with php8. Restructure nginx configs ([see changes announcement](https://info.linuxserver.io/issues/2022-08-20-nginx-base)).
* **14.03.22:** - Add symlinks for theme support.
diff --git a/package_versions.txt b/package_versions.txt
index 2e74f91..839b4fc 100644
--- a/package_versions.txt
+++ b/package_versions.txt
@@ -11,14 +11,14 @@ busybox-1.34.1-r7
ca-certificates-20220614-r0
ca-certificates-bundle-20220614-r0
coreutils-9.0-r2
-curl-7.80.0-r3
+curl-7.80.0-r4
dbus-libs-1.12.24-r0
encodings-1.0.5-r0
-expat-2.4.9-r0
+expat-2.5.0-r0
fontconfig-2.13.1-r4
freetype-2.11.1-r2
gdbm-1.22-r0
-git-2.34.4-r0
+git-2.34.5-r0
glib-2.70.1-r0
icu-libs-69.1-r1
libacl-2.2.53-r0
@@ -27,8 +27,8 @@ libblkid-2.37.4-r0
libbsd-0.11.3-r1
libbz2-1.0.8-r1
libc-utils-0.7.2-r3
-libcrypto1.1-1.1.1q-r0
-libcurl-7.80.0-r3
+libcrypto1.1-1.1.1s-r1
+libcurl-7.80.0-r4
libedit-20210910.3.1-r0
libevent-2.1.12-r4
libffi-3.4.2-r1
@@ -48,7 +48,7 @@ libretls-3.3.4-r3
libsasl-2.1.28-r0
libseccomp-2.5.2-r0
libsm-1.2.3-r0
-libssl1.1-1.1.1q-r0
+libssl1.1-1.1.1s-r1
libstdc++-10.3.1_git20211027-r0
libuuid-2.37.4-r0
libwebp-1.2.2-r0
@@ -57,7 +57,7 @@ libxau-1.0.9-r0
libxcb-1.14-r2
libxdmcp-1.1.3-r0
libxext-1.3.4-r0
-libxml2-2.9.14-r1
+libxml2-2.9.14-r2
libxmu-1.1.3-r0
libxpm-3.5.13-r0
libxt-1.2.1-r0
@@ -74,31 +74,31 @@ netcat-openbsd-1.130-r3
nghttp2-libs-1.46.0-r0
nginx-1.20.2-r1
oniguruma-6.9.7.1-r0
-openssl-1.1.1q-r0
+openssl-1.1.1s-r1
pcre-8.45-r1
pcre2-10.40-r0
-php8-8.0.18-r0
-php8-common-8.0.18-r0
-php8-ctype-8.0.18-r0
-php8-curl-8.0.18-r0
-php8-dom-8.0.18-r0
-php8-fileinfo-8.0.18-r0
-php8-fpm-8.0.18-r0
-php8-gd-8.0.18-r0
-php8-ldap-8.0.18-r0
-php8-mbstring-8.0.18-r0
-php8-mysqlnd-8.0.18-r0
-php8-openssl-8.0.18-r0
-php8-pdo-8.0.18-r0
-php8-pdo_mysql-8.0.18-r0
+php8-8.0.25-r0
+php8-common-8.0.25-r0
+php8-ctype-8.0.25-r0
+php8-curl-8.0.25-r0
+php8-dom-8.0.25-r0
+php8-fileinfo-8.0.25-r0
+php8-fpm-8.0.25-r0
+php8-gd-8.0.25-r0
+php8-ldap-8.0.25-r0
+php8-mbstring-8.0.25-r0
+php8-mysqlnd-8.0.25-r0
+php8-openssl-8.0.25-r0
+php8-pdo-8.0.25-r0
+php8-pdo_mysql-8.0.25-r0
php8-pecl-igbinary-3.2.6-r0
php8-pecl-memcached-3.1.5-r1
-php8-phar-8.0.18-r0
-php8-session-8.0.18-r0
-php8-simplexml-8.0.18-r0
-php8-tokenizer-8.0.18-r0
-php8-xml-8.0.18-r0
-php8-xmlwriter-8.0.18-r0
+php8-phar-8.0.25-r0
+php8-session-8.0.25-r0
+php8-simplexml-8.0.25-r0
+php8-tokenizer-8.0.25-r0
+php8-xml-8.0.25-r0
+php8-xmlwriter-8.0.25-r0
popt-1.18-r0
procps-3.3.17-r0
qt5-qtbase-5.15.3_git20210713-r5
@@ -110,7 +110,7 @@ skalibs-2.11.0.0-r0
ssl_client-1.34.1-r7
tar-1.34-r0
ttf-freefont-20120503-r2
-tzdata-2022c-r0
+tzdata-2022f-r1
utmps-0.1.0.3-r0
xdg-utils-1.1.3-r0
xprop-1.2.5-r0
diff --git a/readme-vars.yml b/readme-vars.yml
index d91a65d..ac94467 100644
--- a/readme-vars.yml
+++ b/readme-vars.yml
@@ -27,9 +27,10 @@ param_usage_include_env: true
param_env_vars:
- { env_var: "APP_URL", env_value: "", desc: "for specifying the IP:port or URL your application will be accessed on (ie. `http://192.168.1.1:6875` or `https://bookstack.mydomain.com`"}
- { env_var: "DB_HOST", env_value: "", desc: "for specifying the database host" }
+ - { env_var: "DB_PORT", env_value: "", desc: "for specifying the database port if not default 3306" }
- { env_var: "DB_USER", env_value: "", desc: "for specifying the database user" }
- - { env_var: "DB_PASS", env_value: "", desc: "for specifying the database password" }
- - { env_var: "DB_DATABASE", env_value: "bookstackapp", desc: "for specifying the database to be used (non-alphanumeric passwords must be properly escaped.)" }
+ - { env_var: "DB_PASS", env_value: "", desc: "for specifying the database password (non-alphanumeric passwords must be properly escaped.)" }
+ - { env_var: "DB_DATABASE", env_value: "bookstackapp", desc: "for specifying the database to be used" }
param_usage_include_ports: true
param_ports:
@@ -50,6 +51,7 @@ custom_compose: |
- PGID=1000
- APP_URL=
- DB_HOST=bookstack_db
+ - DB_PORT=3306
- DB_USER=bookstack
- DB_PASS=
- DB_DATABASE=bookstackapp
@@ -101,6 +103,7 @@ app_setup_block: |
# changelog
changelogs:
+ - { date: "21.12.22:", desc: "Update db info in .env file when env vars are updated." }
- { date: "10.10.22:", desc: "Remove password escape logic which caused problems for a small subset of users." }
- { date: "20.08.22:", desc: "Rebasing to alpine 3.15 with php8. Restructure nginx configs ([see changes announcement](https://info.linuxserver.io/issues/2022-08-20-nginx-base))." }
- { date: "14.03.22:", desc: "Add symlinks for theme support." }
diff --git a/root/etc/cont-init.d/50-config b/root/etc/cont-init.d/50-config
index 4ac53be..e2840d0 100644
--- a/root/etc/cont-init.d/50-config
+++ b/root/etc/cont-init.d/50-config
@@ -8,7 +8,7 @@ fi
# create directory structure
mkdir -p \
- /config/www/{uploads,files,images,themes}
+ /config/www/{uploads,files,images,themes}
# check for .env and copy default if needed
if [[ ! -f "/config/www/.env" ]] || [[ ! -s "/config/www/.env" ]]; then
@@ -16,22 +16,21 @@ if [[ ! -f "/config/www/.env" ]] || [[ ! -s "/config/www/.env" ]]; then
fi
# create symlinks
-symlinks=( \
-/app/www/themes \
-/app/www/storage/uploads/files \
-/app/www/storage/uploads/images \
-/app/www/public/uploads \
-/app/www/.env \
-/app/www/storage/logs/laravel.log
+symlinks=(
+ /app/www/themes
+ /app/www/storage/uploads/files
+ /app/www/storage/uploads/images
+ /app/www/public/uploads
+ /app/www/.env
+ /app/www/storage/logs/laravel.log
)
-for i in "${symlinks[@]}"
-do
- if [[ -e "$i" && ! -L "$i" ]]; then
- rm -rf "$i"
+for i in "${symlinks[@]}"; do
+ if [[ -e "${i}" && ! -L "${i}" ]]; then
+ rm -rf "${i}"
fi
- if [[ ! -L "$i" ]]; then
- ln -s /config/www/"$(basename "$i")" "$i"
+ if [[ ! -L "${i}" ]]; then
+ ln -s /config/www/"$(basename "${i}")" "${i}"
fi
done
@@ -41,32 +40,59 @@ if [ -n "${TEST_RUN}" ]; then
fi
# Create API key if needed
-if [ ! -f "/config/BOOKSTACK_APP_KEY.txt" ];
- then
+if [ ! -f "/config/BOOKSTACK_APP_KEY.txt" ]; then
echo "Generating BookStack app key for first run"
key=$(php /app/www/artisan key:generate --show)
- echo $key > /config/BOOKSTACK_APP_KEY.txt
- echo "App Key set to $key you can modify the file to update /config/BOOKSTACK_APP_KEY.txt"
-elif [ -f "/config/BOOKSTACK_APP_KEY.txt" ];
- then
+ echo "${key}" >/config/BOOKSTACK_APP_KEY.txt
+ echo "App Key set to ${key} you can modify the file to update /config/BOOKSTACK_APP_KEY.txt"
+elif [ -f "/config/BOOKSTACK_APP_KEY.txt" ]; then
echo "App Key found - setting variable for seds"
key=$(cat /config/BOOKSTACK_APP_KEY.txt)
fi
# .env file setup
# check for the default app key or if it has been updated
-if grep -Fxq "APP_KEY=SomeRandomString" /config/www/.env || \
-! grep -Fxq "APP_KEY=${key}" /config/www/.env; then
+if ! grep -Fxq "APP_KEY=${key}" /config/www/.env; then
sed -i "s#^APP_KEY=.*#APP_KEY=${key}#" /config/www/.env
fi
-# check to see if db_user is set, if it is then run seds and if not then leave them
-if [ "${DB_USER}" ];
- then
- echo "Running config - db_user set"
- sed -i "s/DB_HOST=localhost/DB_HOST=${DB_HOST}/g" /config/www/.env
- sed -i "s/DB_DATABASE=database_database/DB_DATABASE=${DB_DATABASE}/g" /config/www/.env
- sed -i "s/DB_USERNAME=database_username/DB_USERNAME=${DB_USER}/g" /config/www/.env
- sed -i "s/DB_PASSWORD=database_user_password/DB_PASSWORD=${DB_PASS}/g" /config/www/.env
+
+# if DB_HOST contains a port and DB_HOST is not a IPv6 without brackets [..]
+# support ipv4:port, [ipv6]:port, and domain:port
+if [[ ${DB_HOST} =~ :[0-9]+$ ]] && ! [[ ${DB_HOST} =~ ^(:{0,2}[a-fA-F0-9]{1,4})+$ ]]; then
+ DB_HOST_PORT="${DB_HOST}"
+fi
+
+# if DB_HOST_PORT is set
+if [[ -n "${DB_HOST_PORT}" ]]; then
+ # if DB_PORT is set
+ if [[ -n "${DB_PORT}" ]]; then
+ echo "DB_PORT is not supported when using DB_HOST with port"
+ sleep infinity
+ fi
+ DB_HOST="${DB_HOST_PORT%:*}"
+ DB_PORT="${DB_HOST_PORT##*:}"
+fi
+
+# if DB_PORT is not set
+if [[ -z "${DB_PORT}" ]]; then
+ DB_PORT="3306"
+fi
+
+# check to see if DB_HOST is set, if it is then run seds and if not then leave them
+if [[ -n "${DB_HOST}" ]]; then
+ echo "Running config - DB_HOST set"
+
+ if ! grep -xqE "^[#]?DB_PORT=.*" /config/www/.env; then
+ # add DB_PORT line to /config/www/.env because current /app/www/.env.example doesn't have it
+ sed -i -E "/^[#]?DB_HOST=.*/a DB_PORT=${DB_PORT}" /config/www/.env
+ echo "**** Insert DB_PORT=${DB_PORT} into /config/www/.env ****"
+ fi
+
+ sed -i -E "s/^[#]?DB_HOST=.*/DB_HOST=${DB_HOST}/g" /config/www/.env
+ sed -i -E "s/^[#]?DB_PORT=.*/DB_PORT=${DB_PORT}/g" /config/www/.env
+ sed -i -E "s/^[#]?DB_DATABASE=.*/DB_DATABASE=${DB_DATABASE}/g" /config/www/.env
+ sed -i -E "s/^[#]?DB_USERNAME=.*/DB_USERNAME=${DB_USER}/g" /config/www/.env
+ sed -i -E "s/^[#]?DB_PASSWORD=.*/DB_PASSWORD=${DB_PASS}/g" /config/www/.env
fi
# set appurl
@@ -89,10 +115,10 @@ fi
## Bump php upload max filesize and post max size to 100MB by default
if ! grep -qx '^upload_max_filesize.*$' /config/php/php-local.ini; then
- echo 'upload_max_filesize = 100M' >> /config/php/php-local.ini
+ echo 'upload_max_filesize = 100M' >>/config/php/php-local.ini
fi
if ! grep -qx '^post_max_size.*$' /config/php/php-local.ini; then
- echo 'post_max_size = 100M' >> /config/php/php-local.ini
+ echo 'post_max_size = 100M' >>/config/php/php-local.ini
fi
# check for the mysql endpoint